Skip to content
Related Articles
Open in App
Not now

Related Articles

JavaScript | Super keyword

Improve Article
Save Article
  • Last Updated : 01 Jun, 2021
Improve Article
Save Article

Super keyword in JavaScript can be used to access and call on an object’s parent, it can be used in two ways.

  • As a function
  • As an object



Arguments: This keyword can accepts all the arguments that has been used to create a constructor.

Below example illustrates the uses of the super keyword in JavaScript.

Example:  In the constructor of the FashionDesigner class, super has been used as a function. Whereas, in the doTasks() function of the FashionDesigner class, super has been used as an object. In the constructor of the fashion designer class, the super keyword has been used as a function to call the parent class’s constructor by passing the parameters to the fashion designer. This step is important to be carried out to ensure that FashionDesigner is an instance of Person. In the doTasks() function, super is used as an object that refers to the parent class Person’s instance. Here, the super keyword is used to explicitly call the methods of the parent class Person.


<!DOCTYPE html>
    <head> </head>
            class Person {
                constructor(name, age) {
           = name;
                    this.age = age;
                atWork() {
                    return + " is at work, ";
                atHome() {
                    return + " is at home";
                sleeping() {
                    return + " is sleeping";
            class FashionDesigner extends Person {
                constructor(name, age) {
                    super(name, age);
                profession() {
                    return +
                      " is a Fashion Designer";
                doTasks() {
                    return super.atWork() + this.profession();
            function display(content) {
            const character =
            new FashionDesigner("Sayan", 30);


Sayan is a Fashion Designer
Sayanis at home
Sayanis at work Sayan is a Fashion Designer

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!