Inheritance in ES6

This lesson introduces the keywords extends and super and explains their use in implementing inheritance in JavaScript.

Let’s learn how to implement inheritance in the ES6 version of JavaScript.

Syntax

The underlying concept regarding the implementation of inheritance is the same in both versions ES5 and ES6; however, the latter provides a cleaner syntax as well as some new keywords that can be used during the implementation.

The ES6 version uses the keyword extends which creates a class that is the child of another class.

The following is the syntax used in ES6:

Get hands-on with 1200+ tech skills courses.