We have created an object of Customer. It has property value FirstName & LastName. Customer has no property named toString().Then how Customer.toString() returns a value?
So what is in the prototype of Customer object? Let’s see-
To see the prototype of an object or function we may use object.getPrototypeOf().
Adding property in prototype-
We can add any property value or method in prototype of an object. Let’s see how to do this-
So, we have added a new property method in prototype of Customer and get access through reference
The Array object has a prototype Array.prototype and the object instance inherits the properties of the Array object.
Similarly, Functions derived from Function.prototype.
So, from above discussion we can say that the prototype object is special type of enumerable object to which additional properties can be attached to it which will be shared across the instance of it’s constructor.