Chapter 8Using Inheritance
JavaScript’s original implementation of inheritance was different from other mainstream languages in two ways. Although most mainstream languages provided class-based inheritance, JavaScript implemented prototypal inheritance. Furthermore, for the vast majority of programmers it was not clear how to effectively use inheritance in JavaScript. The syntax was confusing, error prone, and hard to maintain. Thankfully, the language has evolved and the syntax for inheritance is now much easier to use and understand.
The updated syntax is akin to Java and that may lead us to believe that the inheritance model of JavaScript is similar to that of Java—but that’s not true. JavaScript has always provided prototypal inheritance ...
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