🔸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