...
/Inheriting from a Class: extends keyword and Prototype Chaining
Inheriting from a Class: extends keyword and Prototype Chaining
Learn about the actions of the extends keyword and discuss how the prototype chain is changed and get shared.
We'll cover the following...
extends
implies prototypal inheritance
Even though JavaScript uses the extends
keyword, which is popular for inheritance in Java, it’s important to remember that the inheritance is prototype-based and not class-based. Let’s verify this key design for inheritance in JavaScript with an example.
Example
We’ll continue with the Person
and ReputablePerson
classes we used in the previous lesson. We can obtain the prototype of an object using the Reflect.getPrototypeOf()
...
Access this course and 1400+ top-rated courses and projects.