class
class Human {
constructor(type = 'human') {
this.type = type;
}
static isHuman(human) {
return human instanceof Human;
}
breathe() {
return 'h-a-a-a-m';
}
}
class Hj extends Human {
constructor(type, firstName, lastName) {
super(type);
this.firstName = firstName;
this.lastName = lastName;
}
sayName() {
// super.breathe();
return `${this.firstName} ${this.lastName}`;
}
}
const oldHj = new Hj('human', 'hyungju', 'lee');
console.log(Human.isHuman(oldHj)); // true
console.log(oldHj.breathe()); // h-a-a-a-m
console.log(oldHj.sayName()); // hyungju lee