Super keyword in JavaScript?

Front End TechnologyJavascriptObject Oriented Programming


The super keyword is used to access and call functions on an object's parent. The super.prop and super[expr] expressions are legible in any method definition in both classes and object literals. It is used in the "extended" class, which uses "extends" keyword.




In the following example, the characteristics of a class called "Person" have been extended to another class called "Student". In both classes, we have used unique properties. Here "super" keyword is used to access a property from parent class(Person) to the extended class(Student), whereas "this" keyword is used to access extended class's own property.

   class Person {
      constructor(name, grade) { = name;
         this.grade = grade;
      goal() {
         return `${} wants to become a crickter!`;
      interest() {
         return `${} interested in cricket !`;
   class Student extends Person {
      constructor(name, grade) {
         super(name, grade);
      need() {
         return `${} needs a cricket kit`;
      career() {
         return `${super.interest()}
   const student = new Student('Rishab pant', '7');


Rishab pant interested in cricket !
Rishab pant wants to become a crickter!
Rishab pant needs a cricket kit
Updated on 17-Jun-2020 07:09:16