1、ES6 class的使用
- JavaScript使用的是原型式继承,通过原型的特性实现类的继承
- ES6为我们提供了像面向对象继承一样的语法糖
class Parent {
constructor(a){
this.filed1 = a;
}
filed2 = 2;
func1 = function(){}
}
class Child extends Parent {
constructor(a,b) {
super(a);
this.filed3 = b;
}
filed4 = 1;
func2 = function(){}
}