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 ...

Get Mastering JavaScript Object-Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.