DELAPARRA
Index
Color
NL
Category: Programming paradigms

Prototype Chain

Explained by Updated

What is Prototype Chain?

Prototype Chain: The link from an object to its prototype, to that prototype's prototype, and so on — used to resolve property lookups. The prototype chain is the series of links JavaScript follows when you look up a property. If the object does not have it, JavaScript checks the object's prototype, then that prototype's prototype, and so on until it reaches Object.prototype and finally null.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Prototype Chain

How is Prototype Chain used in practice?

This is how inheritance works in JavaScript. A class that extends another class sets up a chain, so instances find methods from both their own class and the parent.

What should you keep in mind with Prototype Chain?

Two practical consequences matter. Lookups for missing properties walk the whole chain, which is why accessing a typo'd property returns undefined instead of an error. And for...in loops include inherited enumerable properties, which is one reason Object.keys() or for...of over Object.entries() is usually the safer choice.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with P

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.