Skip to main content

Command Palette

Search for a command to run...

What is Prototype chain ?

Published
โ€ข1 min readโ€ขView as Markdown
What is Prototype chain ?

In our previous article we saw what is prototype inheritance. If you haven't read about it , do have a look at it.

Let's look at the same example. The ability of the object (maria) to look up for properties in its prototype is known as Prototype chain. Here the object(maria) and Employee.prototype forms a prototype chain.

But is that all ? ๐Ÿค”๐Ÿ’ญ Employee.prototype is also an object. All objects in JS also have a prototype(_ _proto_ _).

Lets dive deeper.

The prototype of Employee.prototype is Object.prototype. Why? Employee.prototype is an object which is created by the constructor function Object() , when we use the new() for creating an object.

The prototype of Object() is Object.prototype.

This chain of objects connected through prototypes is known as Prototype Chain. Object.prototype stays at the top of the chain. So what is the prototype of Object.prototype ? ๐Ÿค” It is null !

Untill the next one , Break,Code,Repeat !๐Ÿ˜€

More from this blog

Untitled Publication

9 posts

Break. Code. Repeat.