What are the differences between ES6 class and ES5 function constructors?
ES6 class and ES5 function constructors are both used to create objects in JavaScript, but there are some differences between the two.
Syntax: The syntax for creating objects using ES6 classes is different from ES5 function constructors. ES6 classes use a more traditional class-based syntax, while ES5 function constructors use a constructor function with the ‘new’ keyword.
Inheritance: ES6 classes have built-in support for inheritance, using the ‘extends’ keyword to create a subclass. ES5 function constructors can also create subclasses, but it requires more complex prototypal inheritance.
Strict mode: ES6 classes are always in strict mode by default, while ES5 function constructors are not.
Default parameter values: ES6 classes allow you to set default values for parameters, while ES5 function constructors do not.