Every object has a hidden
[[Prototype]]
property, which is used for inheritance. Functions additionally have a publicprototype
property, which is used only when the function is used as constructor: When an object is constructed usingnew
, the[[Prototype]]
property of the new object is set to theprototype
property of the function that was used as constructor.
[[Prototype]] is accessible via __proto__ or getPrototypeOf in some browsers.