A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-165.js
1classA{staticmake(){returnnewthis();}}
2classBextendsA{}
3console.log(B.make()instanceofB);
Scope
Answer & explanation
Console output
true
Why
Inside a static method, this is the class the method was called on, which for B.make() is B even though make is inherited from A. So new this() builds a B instance, making the result instanceof B. This pattern lets a base class provide factory methods that respect the actual subclass.