Chapter 5. Inheritance
Learning how to create objects is the first step to understanding object-oriented programming. The second step is to understand inheritance. In traditional object-oriented languages, classes inherit properties from other classes.
In JavaScript, however, inheritance can occur between objects with no classlike structure defining the relationship. The mechanism for this inheritance is one with which you are already familiar: prototypes.
Prototype Chaining and Object.prototype
JavaScript’s built-in approach for inheritance is called prototype chaining, or prototypal inheritance. As you learned in Chapter 4, prototype properties are automatically available on object instances, which is a form of inheritance. The object instances ...
Get The Principles of Object-Oriented JavaScript 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.