re: Prototype in Javascript - 01 - Object creation VIEW POST


Hey I have a question having an object with user1.increaseScore()
Does this issue you mention under the last paragraph happens with Classes as well?
For example if User was a class (with a constructor) and has the increaseScore() method. Is not memory efficent as well?


I'm glad you asked this question. The short answer is that it is memory efficient. But one needs to remember that class in JavaScript is just syntactic sugar and basically does the same thing as creating an object through a function under the hood. I shall be talking about prototypes in classes in detail in part 4 of this series!


Ok you won a follow

Glad you found my content helpful, Luis!

Code of Conduct Report abuse