js 创建类
class Person{
constructor(name, age){ // 构造器
this.name = name;
this.age = age;
}
// 一般方法
speak(){
console.log('我叫${this.name}, 年龄${this.age}')
}
}
class Student extends Person(){
constructor(name, age, grade){
super(name, age);
this.grade = grade;
}
}

浙公网安备 33010602011771号