Classes can inherit from other classes.
Source Code
class Employee extends Person {
constructor(name, position) {
super(name);
this.position = position;
}
showInfo() {
console.log(`${this.name} works as a ${this.position}`);
}
}
let employee = new Employee('Jane', 'Developer');
employee.greet(); // Hello, Jane
employee.showInfo(); // Jane works as a Developer