4 ms·
> a generic substitute for `window` could also be specified Isn't that just |this| at the top level?
by reubenmorais 11y ago
> a generic substitute for `window` could also be specified
Isn't that just |this| at the top level?
- singlow 11y agoNot necessarily the _top_ level if you are referring to scope. `this` will be the default global unless another context is defined, whether you are at the top level or inside a function. In node, there is a name for the default global: "global", which is also the default context. So node gives it a "generic substitute" as the OP suggested. Most people use "this" to make assignments to it, rather than the "global" name, since it is usually accessed from the default context.