Here we named our “class” with a capital letter “Car” (to indicate class). We create an instance of that class with the “new” operator. That instance is saved to variable myCar (lowercase to indicate instance). With this instance, we can call the methods of the class. This method of creating classes is “classical inheritance”, because it is similar to how some of the other languages create classes.
You create an object (or “class”) using object literal. And then create new instances of this class by using Object.create and then override whatever properties and methods you need to. Modern browsers and Internet Explorer 9 can use Object.create. IE8 will require a polyfill.
3. ES6 Classes
You can also “extend” a class like this …
Here the class “SUV” extends “Car”. Its constructor calls the parent constructor with “super”. You can overwrite the parent method easily as shown above.