__proto__ VS. prototype in JavaScript -


this figure again shows every object has prototype. constructor function foo has own __proto__ function.prototype, , in turn references via __proto__ property again object.prototype. thus, repeat, foo.prototype explicit property of foo refers prototype of b , c objects.

var b = new foo(20); var c = new foo(30); 

what differences between __proto__ , prototype properties?

enter image description here

the figure taken here.

__proto__ actual object used in lookup chain resolve methods, etc. prototype object used build __proto__ when create object new:

( new foo ).__proto__ === foo.prototype ( new foo ).prototype === undefined 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -