A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-119.ts
1classA{who(){return'A';}}
2classBextendsA{
3who(){return'B';}
4callSuper(){returnsuper.who();}
5}
6classCextendsB{who(){return'C';}}
7console.log(newC().callSuper());
Classes
Answer & explanation
Console output
A
Why
super is bound to the home object of the method`s defining class, not to the runtime instance. Since callSuper is defined in B, `super.who()` always targets A.who() even when called on a C instance. super resolution is static (based on where code is written), unlike `this.who()` which would dispatch to C.