Reputation: 41
I try to understand prototype and gain a clear understanding so fur. Which i do not understand is that,
is __proto__
is a property of an object instance
or its a property of Object.prototype
which we can use from object instance . I know other aspect about prototype and prototype chain and only want to know specifically that who won __proto__
actually ? Is its owner is every object instance
or Object constructor
(which we have to call new) prototype ?
Upvotes: 0
Views: 57
Reputation: 191
From MDN:
The
__proto__
property ofObject.prototype
is an accessor property (a getter function and a setter function) that exposes the internal [[Prototype]] (either an object or null) of the object through which it is accessed.
const obj = {};
console.log(obj.hasOwnProperty('__proto__')); // false
console.log(Object.prototype.hasOwnProperty('__proto__')); // true
__proto__
is somewhat deprecated. It's better to use:
Upvotes: 1