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。如果你的问题的答案可以帮助你,你可以接受它。 –