Summary
In this chapter, we explored the inheritance mechanism of JavaScript based on prototypes, which is objects that act as templates for other objects. We saw how objects can be linked each other through their prototypes to create a chain representing the inheritance hierarchy. Then, we talked about the creation of an inheritance relationship between constructor functions and about the simplicity of new ECMAScript 6 syntax for extending classes. Our discussion continued with the different ways to control inheritance: from overriding methods and properties to the implementation of protected members, from the prevention of object extension to the creation of immutable objects.
The chapter concluded with some examples of implementation of multiple ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access