Classes
In this lesson you'll learn a clearer way of doing prototype inheritance in ES6.
We'll cover the following...
We'll cover the following...
Quoting MDN:
“Classes are primarily syntactic sugar over
Javascript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.”
That being said, let’s review prototypal inheritance before we jump into classes.
We added a new method to the prototype in order to make it accessible to all the new instances of Person that we created.
Ok, now that I refreshed your knowledge of prototypal inheritance, let’s have a look at classes.
Create a class #
There are two ways of creating a ...