类的继承
//class类的使用
class ai{
constructor(hp,speed) {
this.hp = hp;
this.speed = speed;
}
move(){
//:function可以省略
console.log(`速度是${
this.speed}`)
}
}
class addai extends ai{
//继承父类ai
constructor(hp,speed,attacs) {
super(hp,speed) //通过super初始化父类