What’s the purpose of prototype? [duplicate]
Using the prototype makes faster object creation since properties/methods on the prototype don’t have to be re-created each time a new object is created. When you do this: function animal() { this.name=”rover” this.set_name = function (name) { this.name = name } } The set_name method is created every time you create an animal. But when … Read more