根据下面这段代码,子类Student继承父类Person,简单易懂的画出上图的原型链图解。
class Person {
constructor(name) {
this.name = name;
}
say() {
console.log(`我的名字是${this.name}`);
}
}
class Student extends Person {
constructor(name,score) {
super(name);
this.score = score;
}
study() {
console.log(`我是${this.name},我正在学习`);
}
}
let student = new Student('张三','98');
student.study();
student.say();