๐ธprototype
๐ง under construction
JS โฉ value โฉ object โฉ prototype
desc
objects have a special hidden property
[[Prototype]]
that is eithernull
or references another object (other types are ignored).that object is called a โprototypeโ.
when we access an object's method/property, and itโs missing, JavaScript automatically takes it from the prototype.
__proto__
is a getter/setter for [[Prototype]] and resides in Object.prototype.
is considered outdated, modern methods are:
to access
[[Prototype]]
(which is hidden and internal).
prototype chain can't go in circles.
Last updated
Was this helpful?