In ES6, the following yields a compilation error:
class A {
constructor() {
this.someVal = 10;
}
}
class B extends A {
constructor() {
this.otherVal = 20;
}
}
The error (as yielded by Babel 6) is:
'this' is not allowed before super()
It is clear to me why super needs to be invoked first, but I do not understand why it needs to be invoked explicitly. Is there a rationale for not simply, as in Java (for example), simply letting super
be invoked without arguments if nothing else is specified?