1、class的基本写法
class a{
// 传入参数或者写入固定参数
constructor(a,b){
this.a=a
this.b=b
}
// 可直接调用的计算后的参数
get c(){
return this.a+this.b
}
// 可以调用的普通的方法
calc(){
return this.a*this.b
}
// 无需new就可以直接引用的方法
static mius(d,e){
return d-e
}
}
var x=new a()
2、继承class
class l extends a {
calc(){
console.log(super.calc())
return this.a-this.b
}
}
var w=new l()