Skip to content

Prototypes

Every JavaScript object has a prototype — an internal reference to another object from which it inherits properties. This is JavaScript’s mechanism for prototypal inheritance.

  • Understand the prototype chain and how property lookup works
  • Learn how to set and get prototypes
  • Master Object.create() for prototypal inheritance
  • Understand built-in prototypes (Array.prototype, etc.)
  • Know when to use prototypes vs instance properties
flowchart TD
A["myArray: [1, 2, 3]"]
B["Array.prototype: push, pop, map..."]
C["Object.prototype: toString, hasOwnProperty..."]
D["null"]
A -->|"[[Prototype]]"| B
B -->|"[[Prototype]]"| C
C -->|"[[Prototype]]"| D
TopicDescriptionEst. Time
Prototype ChainHow property lookup traverses the chain15 min
Setting PrototypesObject.create, proto, setPrototypeOf15 min
Built-in PrototypesArray, Function, Object prototypes10 min
Prototype vs InstanceOwn properties vs inherited, hasOwnProperty10 min
  • Objects and how they work
  • Functions and constructors
  • Basic understanding of inheritance
Prototype Chain → Setting Prototypes → Built-in Prototypes → Prototype vs Instance
  • Every object has a [[Prototype]] (internal link to another object)
  • Property lookup walks up the chain until found or null
  • Object.create() creates objects with a specific prototype
  • Methods on the prototype are shared across all instances
  • The chain always ends at null