Prototype chaining in JavaScript

All the objects in JavaScript have a built-in property which is termed its prototype.

All the objects in JavaScript have a built-in property which is termed its prototype. The amazing thing here is that the prototype itself is an object so it has its own prototype, this phenomenon is termed prototype chaining or prototype chain. When a prototype has null for its own prototype then the prototype ends.

Prototype chaining in JavaScript

The above chain shows an object chaining of Employee Object Which has a prototype Person which has Object.prototype as prototype and Object.prototype has Null as a prototype so the chain ends there.