共计 341 个字符,预计需要花费 1 分钟才能阅读完成。
<!--js 文件 -->
<!--class 继承类 -->
class People{constructor(name,age){
this.name = name;
this.age = age;
},
sayHide(){
console.log(` 姓名:${this.name}, 年龄 ${this.age}`
)
}
}
<!-- 通过类 new 一个实例 / 对象 -->
const xiaoming = new People('xiaoming','19');
xiaoming.sayHide();
class Student extends People{constructor(name,number){super(name);
this.number = number;
},
}
const wang = new People('wang',1);
正文完
发表至: javascript
2020-08-11