What is the requirement of a prototype object?
In a prototype-based approach, all the objects share the same function. This ignores the requirement of creating a new copy of function for each object. Thus, the functions are loaded once into the memory.
Let's see an example to add a new method to the constructor function.Test it Now
Martin Roy Duke William
Let's see an example to add a new property to the constructor function.Test it Now
Martin Roy Javatpoint Duke William Javatpoint