How to implement inheritance in ES6 ? Last Updated : 08 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will know how inheritance is implemented in es6. The ES6 JavaScript supports Object-Oriented programming components such as Object, Class and Methods. Further in Classes we can implement inheritance to make child inherits all methods of Parent Class. This can be done using the extends and super keywords. We use the extends keyword to implement the inheritance in ES6. The class to be extended is called a base class or parent class. The class that extends the base class or parent class is called the derived class or child class. The super() method in the constructor is used to access all parent's properties and methods that are used by the derived class. The below example will demonstrate the use of the extends and super keywords. Example: Let us create a Shop class that will inherit the methods from the parent "Mall" class. HTML <!DOCTYPE html> <html> <body> <h2>JavaScript Class Inheritance</h2> <p id="demo"></p> <script> class Mall { constructor(shopname) { this.shopname = shopname; } shopispresent() { return this.shopname + ' is present in the '; } } class Shop extends Mall { constructor(name, mallname) { super(name); this.mallname = mallname; } showshop() { return this.shopispresent() + this.mallname; } } let newMall = new Shop( "Domino", "Select City Walk Mall" ); document.getElementById("demo") .innerHTML = newMall.showshop(); </script> </body> </html> Output: Explanation: In the above example, the super keyword is used as a “function” which calls the parent class Mall with the parameter passed to Shop. This is a key step to be carried out in order to make sure that Shop is an instance of Mall.On the other hand, extends keyword is used to set Shop as a subclass or child class of Mall. The use of extends is a must to set some class as a child of other class. Comment More infoAdvertise with us Next Article Implementing Interfaces in JavaScript F faizamu19 Follow Improve Article Tags : JavaScript Web Technologies ES6 JavaScript-Questions Similar Reads How to implement Inheritance in Typescript ? Inheritance is a major pillar of object-oriented programming languages and inheritance is used to create a new class from the existing one. The newly created class is known as the Derived class and the class from which the derived class inherited is known as the Base class. An inherited derived clas 2 min read How to implement inheritance in Node.js bindings? Node.js serves as a robust runtime environment, empowering developers to construct server-side applications that are both scalable and efficient. One of its key features is the ability to bind to C or C++ libraries, providing a bridge between JavaScript and lower-level languages. In this article, we 3 min read Which keywords can be used to implement inheritance in ES6 ? In this article, we will discuss the keywords that can be used to implement inheritance in es6?In JavaScript, the "extends", "this" and "super " keywords are used to implement inheritance. Extends keyword: To construct a class that is a child of another class, use the extends keyword in class declar 3 min read What is Components Inheritance in React ? In React, Component Inheritance refers to one component inheriting the behaviors of another component. It allows objects to have those properties that already exist on previous or parent objects. It is a concept that plays a major role in object-oriented programming. Two classes exist for Component 2 min read Implementing Interfaces in JavaScript In JavaScript, there is no built-in concept of interfaces like you might find in languages like Java or C#. However, you can achieve similar functionality by defining and implementing your own interfaces using objects and classes. In this explanation, this article will guide you through the process 2 min read Explain sub-classes and inheritance in ES6 Sub-class: A subclass is a class that is derived from the properties and methods of some other class known as the Parent class for that subclass. A subclass allows us to change or update the properties of the parent class without disturbing it. A subclass can contain properties of the parent class a 3 min read Like