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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.