When you open the Chrome devtool and enter the code snippet below:
// The iife is irrelevant
let r = (() => { return 2; })();
and then evaluate r
, the output will be:
r
2
Surprisingly, both window.r
and globalThis.r
return undefined
. Although let
is block scoped, it raises a question about where the parent object of r
is located. Even though I can access r
directly within the devtool, it seems to exist in a specific block that is not associated with any global object.