如何使用 js 实现一个 ES6 中 class 的 extends 功能 All In One
extends
class Human {
constructor(name) {
this.name = name ?? 'unknown';
}
getName() {
return this.name;
}
setName(name) {
if(name) {
this.name = name;
}
}
}
class Person extends Human {
constructor(name) {
// super 调用父类 constructor
super(name);
this.alias = `
标签:ES6,name,height,width,extends,constructor,js,class
From: https://www.cnblogs.com/xgqfrms/p/17189520.html