0
How to create prototype in JavaScript
im not understood what exactly for prototype is used
2 Respostas
+ 2
Prototype is related to the object oriented aspect of Javascript. To keep it simple, every object in Javascript has a prototype (eg: Date)
The prototype is a kind of a blueprint for the object.
The following code create an object and then use its prototype to add a method:
function myClass(){
myClass.prototype.myMethod = function(){
console.log('hello world')
}
}
0
thanks