class Worker {
constructor(_id, _name) {
this.id = _id;
this.name = _name;
this.view = function() {
console.log(this.id + ' ' + this.name);
};
}
}
class Department extends Worker {
constructor(id, name, _department) {
super(id, name);
this.department = _department;
this.show = function() {
this.view();
console.log(this.department);
};
}
}
const department = new Department(2345, 'Tom', 'Programming');
department.show();
/*
run:
2345 Tom
Programming
*/