JavaScript/Notes/Prototype

From Noisebridge
Revision as of 20:24, 30 December 2013 by Garrett (talk | contribs) (Created page with "== Prototype Chain == Every object created by a constructor has an implicit reference (called the object’s prototype) to the value of its constructor’s “prototype” p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Prototype Chain

Every object created by a constructor has an implicit reference (called the object’s prototype) to the value of its constructor’s “prototype” property. Furthermore, a prototype may have a non-null implicit reference to its prototype, and so on; this is called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on. (§4.2.1 Objects).