O'Reilly logo

JavaScript for Absolute Beginners by Terry McNavage

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required