Can a class extend multiple classes?

Question

In the context of this lesson, can a class extend multiple classes?

Answer

No, in JavaScript, a class cannot extend from multiple classes, which is also known as “multiple inheritance”.

In JavaScript, objects can only be associated with a single prototype, and extending multiple classes would mean that an object associates with multiple prototypes, which is not possible.

A workaround to this is that, if you need a class to inherit the attributes and methods of multiple classes, you might create a new class with those attributes and methods defined in it.