javascript - What does a constructor function's __proto__ attribute point to? -
i'm trying go , better understanding of prototypal inheritance. understand instance's __proto__ attribute points constructor function's prototype object, constructor function's __proto__ attribute point to?
i had assumed constructor function instance of function, point function constructor's prototype object, following shows empty function.
var example = function(){ this.attribute = 'example'; } var exampleinstance = new example(); exampleinstance.__proto__ === example.prototype // true example.__proto__ // function() {} [edit] ovidiu dolha has confirmed understanding maybe helpful somebody.
example.__proto__ same function.prototype, exampleinstance.__proto__ same example.prototype
this because example instance of function.
everything object.prototype root in terms of prototypical inheritance.
note should avoid using __proto__ if possible considered deprecated. instead use object.getprototypeof()

Comments
Post a Comment