What does this log when a base class constructor calls a method that the subclass overrides?
class Base {
name = "base";
constructor() {
console.log("Base sees", this.name);
this.describe();
}
describe() {
console.log("Base.describe", this.name);
}
}
class Child extends Base {
name = "child";
describe() {
console.log("Child.describe", this.name);
}
}
const child = new Child();
console.log(child.name);
The answer
Work out every line it logs, in order. Then check.
Checking your sign-in…