Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class vs Prototype

What makes ES6 class syntax better than traditional prototype approach?

Should I replace all my current objects with classes since I don't care about the cross browser stuff?

like image 850
Lewis Avatar asked Oct 31 '22 07:10

Lewis


1 Answers

ES6 classes are a simple sugar over the prototype-based OO pattern. Having a single convenient declarative form makes class patterns easier to use, and encourages interoperability. Classes support prototype-based inheritance, super calls, instance and static methods and constructors.

like image 121
OddDev Avatar answered Nov 13 '22 06:11

OddDev