Class

class Car{
constructor(name, wheels){
this.name = name;
this.wheels = wheels;
}
showDetail(){
console.log(`${this.name} have ${this.wheels} wheels`);
}
}
var c = new Car("BMW", 4);
c.showDetail(); // BMW have 4 wheels

Class Inheritance

class Car{
constructor(name, wheels){
this.name = name;
this.wheels = wheels;
}
showDetail(){
console.log(`${this.name} have ${this.wheels} wheels`);
}
}
var c = new Car("BMW", 4);
c.showDetail(); // BMW have 4 wheels
class Maruti extends Car{
constructor(){
super("Maruti", 4);
this.cost = "cheap";
super().showDetail();
}
showDetail(){
console.log(`${this.name} have ${this.wheels} wheels and it's super ${this.cost}`);
}
}
var m = new Maruti();
m.showDetail(); // Maruti have 4 wheels and it's super cheap