A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-122.js
1constobj={
2v:3,
3m(){return(()=>this.v)();}
4};
5constfn=obj.m;
6console.log(obj.m(),typeoffn);
Scope
Answer & explanation
Console output
3 function
Why
When called as obj.m(), the method’s this is obj, and the immediately-invoked arrow inside inherits that this lexically, so it returns obj.v = 3. Assigning obj.m to fn merely copies the function reference without invoking it, so typeof fn is simply "function". The arrow’s lexical this is what lets the method read v even when the call goes through an inner function.