DEV Community

Harit Himanshu
Harit Himanshu

Posted on

Should we include methods in prototypes for ES6 Classes for performance?

So as I learn more about the Prototypal Inheritance in JS, I read the following in MDN article (read lines just above this link)

Note that when we are calling our constructor function, we are defining greeting() every time, which isn't ideal. To avoid this, we can define functions on…

Top comments (1)

Collapse
 
harittweets profile image
Harit Himanshu

*UPDATED ANSWER!! *

ES6 Classes puts the methods (also known as class methods) on Class Prototype.

See updated Question at stackoverflow.com/questions/579290...