Sunday, May 15, 2016

constructor__is__prop_of_prototype

function Foo(){};
var aFoo = new Foo();
//constructor__is__prop_of_prototype
//aFoo.hasOwnProperty("constructor") is false, aFoo.constructor is actually Foo.prototype.constructor
alert( Foo.prototype.constructor === aFoo.constructor ) // alert "true"

No comments:

Post a Comment