0
我嘗試調用父類的方法,但我得到的錯誤:錯誤:調用super之外類的構造函數的
Error: call super outside of class constructor
我的例子:
class xo{
cool(x){
console.log(`parent init${x}`)
}
}
class boo extends xo{
cool(val){
super(val);
console.log(`child init${x}`)
}
}
x = new boo;
@zloctb。如果你的問題的答案可以幫助你,你可以接受它。 –