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 !๐