A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-142.js
1constobj={
2v:7,
3outer(){
4constinner=()=>()=>this.v;
5returninner()();
6}
7};
8console.log(obj.outer());
Scope
Answer & explanation
Console output
7
Why
The method outer is invoked as obj.outer(), so its this is obj. The two nested arrow functions have no this of their own and lexically inherit outer’s this, so calling them still reads obj.v = 7. Nested arrows preserving the method’s this through several layers is exactly why they are favored over regular function callbacks inside methods.