class A{
constructor(){
this.name="A";
}
M1(){
return "M1";
}
}
class B extends A{
constructor(){
this.id="B";
}
M2(){
return "M2";
}
}
var b = new B();
выход:При создании объекта класса, он выдает ошибку
ReferenceError: this is not defined at B (repl:4:1) at repl:1:9 at REPLServer.defaultEval (repl.js:262:27) at bound (domain.js:287:14) at REPLServer.runBound [as eval] (domain.js:300:12) at REPLServer. (repl.js:431:12) at emitOne (events.js:82:20) at REPLServer.emit (events.js:169:7) at REPLServer.Interface._onLine (readline.js:211:10) at REPLServer.Interface._line (readline.js:550:8)
Привет, Сурен, не могли бы вы объяснить его более подробно. – user3666112
@ user3666112 обновлен –
Спасибо @Suren за вашу помощь. – user3666112