What is the Prototype?
It is an internal property of objects. It contains common attributes related to the reference object.
The Array object has a prototype Array. prototype and the object instance, num, inherits the properties of the Array object.
When creating objects using a constructor, the objects inherit prototype properties of it(constructor). By using new keyword can create objects.
From the example above, the print function is properties of the Vehicle object, and instances of the Vehicle object like Car can inherit all its properties. When calling to a property of an object, if the requested property does not have in it, then search its prototype for the requested one. Actually, the
prototype is a great ancestral prototype, it is the entity behind almost all objects.
But if the bar weren't found on my Object, Its prototype chain, if nonempty is again consulted and followed. This process continues until either a matching property name is found, or the
prototype chain ends. If no matching property is ever found by the end of the chain, the return result from the operation is undefined.
This is the end of JavaScript prototypes. I hope you will understand what they mean and how to use them.