re: 10 JavaScript concepts you need to know for interviews VIEW POST

FULL DISCUSSION
 

With the advent of the class keyword in ES6, is it still necessary to understand prototype and friends?

 

Unfortunately yes, even with the nicer syntax it's still plain old prototype chain. They missed the historical opportunity to clean up this mess.

 

I think it is, because, in the background, class still uses prototype chain etc. You might understand some things better (or debug faster) if you understand how it really works.

 

The class keyword is just different syntax for creating objects. Once the object is created it still uses the same prototypal inheritance objects always have.

Using the 'class' keyword without understanding prototypal inheritance is like building a house with no understanding of carpentry. Eventually something's going to break, and you won't know how to fix it.

 

Absolutely. The class keyword uses prototypes in its implementation. It's just "syntactic sugar", or a simpler way of using prototypes, but we're still using prototypes nonetheless. It's key to the core of OOP in JS.

code of conduct - report abuse