<script>
class People{
constructor(name='哇哇'){
this.name=name
}
speak(age=12){
console.log(`名字:${this.name},年龄:${age}`)
}
}
class another extends People{
speak(){
super.speak();
console.log(`他的名字叫${this.name}`)
}
}
const man=new People();
man.speak(14);//名字:哇哇,年龄:14
const say=new another('旺旺');
say.speak();//名字:旺旺,年龄:12 他的名字叫旺旺
</script>