面向对象class继承
原创
©著作权归作者所有:来自51CTO博客作者LovewiShare的原创作品,请联系作者获取转载授权,否则将追究法律责任
1 class Student {
2 constructor(name) {
3 this.name = name;
4 }
5 hello(){
6 alert("hello");
7 }
8 }
9 var xiaoming = new
1 class Student {
2 constructor(name) {
3 this.name = name;
4 }
5 hello(){
6 alert("hello");
7 }
8 }
9
10 class XiaoStudengt extends Student{
11 constructor(name,grade) {
12 super(name);
13 this.grade = grade;
14 }
15 myGrade(){
16 alert('我是一名小学生')
17 }
18 }
19 var xiaoming = new
原型链: