Building objects via classes, and organizing them in hierarchies in JavaScript, is hard. Functions, constructors, the prototype property—combine all of these using a secret recipe, sprinkle some magic dust, and voila, we have inheritance, assuming we get all the wiring correct. Without having an intricate understanding of how JavaScript prototypal inheritance works, it feels like its black magic.
In this chapter we will see how we can easily create classes and build inheritance trees in our code using several new keywords like class, extends, and super that were introduced in ES6, allowing us to ...