DEV Community

Cover image for What is prototype chain in Javascript?
Lawaanu Borthakur
Lawaanu Borthakur

Posted on • Updated on

What is prototype chain in Javascript?

In the previous post I have explained about prototype and how it is linked to another.

The prototype object has prototype of its own and so on until an object is reached with null as its prototype. So, this linking with one another is called as prototype chain.Null has no prototype and it acts as a final link in this prototype chain.

Lets take the previous post example:

let fruits=["Apple","Orange"];

In the earlier post we have seen that how fruits array is linked to Array Prototype by using the __proto__ getter function in the console. So, in the similar way Array Prototype also has a prototype called Object prototype and if we try to view the prototype object by using __proto__ to Object prototype then it will reached the final link as null prototype.
Console view of Prototype chain

Oldest comments (0)