构造函数继承
// Person类 (构造方法其实就是一个类)
function Person() {
this.name = 'xiaoyu';
this.say = () => {
console.log('I am saying')
}
}
function Student() {
Person.call(this); // 这里是构造函数继承的关键代码
this.age = 18;
}
let xiaoyu = new Student();