Prototypal Model is much reliable and stronger compared to the classical model where you work with classes in languages like (C++ or Java). The prototypal model can provide more functionality and control over your base objects and their instances.
The prototype chain is a pointer chain where a child object points to its parent (the object it has been created from) and so on till it reaches the end of the chain where it ends with null.
The instance object shares the same prototype as the parent object this way the base object can forward properties and methods to its children (that’s how inheritance works).
Take a look at the below diagram:
Foo is a Constructor Function.
b and c are instances of Foo (created by its constructor)
Foo also has a proto property, this property points to the base prototype that is used to create the current Object (function). it plays the role of chain holder it maintains the chain so whenever you need to look for an inheritance to check a parent of a child instance you look under proto property.
Both c and b proto property point to Foo.prototype so c and b instances have access to all properties under Foo.prototype. The trick is if you want to add properties that get added to the inherited objects you can add them under the parent’s prototype object.
So always remember there are two types of main properties to look at under objects for knowing inheritance:
prototype is an Object that has base properties and function that will be forwarded to the inherited child.
proto links to the prototype that has been used to create the current object (plays a role of pointer that maintains the prototypal chain).
If you would like to break the prototype chain you can simply set at any point in the chain (any object) it’s proto property to null so it thinks it is the end of the chain.