I'm still struggling with this. Does *anyone* know where, in the wild, Module Environments (a type of Lexical Environment) exist?https://twitter.com/padolsey/status/1151148086812696576 …
At least, this is how it works in JS engine binaries that don’t do Node.js-style wrapping.
cc @guybedford @bradleymeck @ljharb @MylesBorins to correct me on the above
-
-
There's also <script>const foo = 'bar'</script> which exists on the global scope but not the global object, right?
-
const/let/class create lexical bindings, so in your example the binding exists in the “top-level lexical scope”, which I see as distinct from the global scope.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
a classic script is wrapped and then run in the global scope