__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?
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
Post a Comment