Every function in JavaScript has a property called prototype
that references an object. This object acts as a shared prototype for all instances created with the function as a constructor. Since the prototype object is shared, any changes made to it will be reflected in all instances.
Note
The prototype chain is a fundamental concept in JavaScript inheritance.
The code below demonstrates how to create instances by calling a constructor function with Pseudoclassical Instantiation (new keyword) and shares a prototype that can be modified in the constructor.
The prototype can be modified even after instances are already initialized. Any changes made to the prototype will be reflected in all existing instances.
References