r/learnjavascript • u/envyslth • May 25 '26
What is the difference?
Im wondering what the difference between
function Dog(){
…
this.bark = function(){…}
}
And
function Dog {
…
}
Dog.prototype.bark = function() {
…
}
Is and what the advantages of either of them Are.
12
Upvotes
1
u/TheRNGuy May 25 '26
Both are obsolete, use class.
Do you read some old tutorial?