Chapter 5. Member Inheritance

In this chapter, I'll cover a feature of JavaScript called inheritance, which is a very useful and powerful tool to acquire. It allows us to write much more ordered and efficient code, because it is a great way to organize your code into useful little lumps. I will cover the following four ways to approach inheritance, each of which has its own place in your programs:

  • Classical

  • Prototypal

  • Deep copy

  • Mixin

As you may have guessed from the chapter title, this chapter covers only member inheritance; Chapter 6 covers how to use inheritance with object functions.

To get to grips with inheritance, you first have to get to know objects a little bit better, so I will start by covering object constructors to see how objects are defined ...

Get JavaScript for Absolute Beginners 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.