Horje
super class js Code Example
super class js
By calling the super() method in the constructor method, we call the parent's constructor method and gets access to the parent's properties and methods:

class Car {
  constructor(brand) {
    this.carname = brand;
  }
  present() {
    return 'I have a ' + this.carname;
  }
}

class Model extends Car {
  constructor(brand, mod) {
    super(brand);
    this.model = mod;
  }
  show() {
    return this.present() + ', it is a ' + this.model;
  }
}

mycar = new Model("Ford", "Mustang");
document.getElementById("demo").innerHTML = mycar.show();




Javascript

Related
javascript reassignment Code Example javascript reassignment Code Example
typeof regex Code Example typeof regex Code Example
How to Delete Comment from Post on Node, express and Mongoose and Ajax Code Example How to Delete Comment from Post on Node, express and Mongoose and Ajax Code Example
two dimensional array object in javascript Code Example two dimensional array object in javascript Code Example
onclick reset  Code Example onclick reset Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8