Why is javascript using classes now

Why is javascript using classes now


i am familiar with java and object oriented programming i feel like is way more organized and allows you to build a better project so my question is why is javascript doing these now is it for the reason that it allows more control over ones project?


No. I would argue that there is no principal advantage of using classes over prototypes, both are oop, just different flavors. I think what is much more important is that java script is not statically typed, which I found very annoying when I got into web development. Using functions as constructors is no big deal when you got used to that.

The reason why classes have been introduced now is because many people coming from other oop languages such as Java, C++ or C# are used to them. They are just syntactic sugar and don’t do anything different than prototypes, they only offer an alternative notation.


I would mostly agree with @lincore, but when writing a React application, ES6 classes are a much better way to organize code. In fact, I insist on going a bit further and using ES7 static properties and decorators as well.