What is the prototype chain in JavaScript?
Understand how JavaScript inheritance works using the prototype chain and __proto__ references.
Question
What is the prototype chain in JavaScript?
Answer
In JavaScript, inheritance happens through the prototype chain — every object has an internal [[Prototype]] link (accessible as __proto__).
When you access a property, JavaScript checks:
- The object itself
- Its prototype
- The prototype’s prototype
... until it reachesObject.prototype
const parent = { greet: () => console.log('Hi!') };
const child = Object.create(parent);
child.greet(); // "Hi!"
If not found in the chain, it returns undefined.
Real-World Example
All arrays inherit from Array.prototype, which inherits from Object.prototype.
Quick Practice
Create two objects linked via prototype and access a property from the parent.
Summary
The prototype chain is JavaScript’s inheritance backbone — flexible, dynamic, and powerful.
Do arrow functions have prototypes?
No, only traditional functions have prototype properties.
Stay Updated
Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.