class A {
constructor() {
this.x = 1;
}
}
class B extends A {
constructor() {
super();
this.x = 2;
super.x = 3;
console.log(super.x); // undefined
console.log(this.x); // 3
}
}
let b = new B();
Why is assigning a value to super in the constructor in the ES6 standard? It is assigning a value to an instance of the class.
Why is super.x
undefined
while this.x
is 3