Skip to content

Commit 035356f

Browse files
tniessenMoLow
authored andcommittedJul 6, 2023
doc: update description of global
With widespread support for ES modules, the description of global is outdated now. PR-URL: #47969 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent dab3186 commit 035356f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎doc/api/globals.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,12 @@ added: v0.1.27
473473
474474
* {Object} The global namespace object.
475475

476-
In browsers, the top-level scope is the global scope. This means that
477-
within the browser `var something` will define a new global variable. In
478-
Node.js this is different. The top-level scope is not the global scope;
479-
`var something` inside a Node.js module will be local to that module.
476+
In browsers, the top-level scope has traditionally been the global scope. This
477+
means that `var something` will define a new global variable, except within
478+
ECMAScript modules. In Node.js, this is different. The top-level scope is not
479+
the global scope; `var something` inside a Node.js module will be local to that
480+
module, regardless of whether it is a [CommonJS module][] or an
481+
[ECMAScript module][].
480482

481483
## Class `Headers`
482484

@@ -868,6 +870,8 @@ added: v18.0.0
868870
869871
A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
870872

873+
[CommonJS module]: modules.md
874+
[ECMAScript module]: esm.md
871875
[Web Crypto API]: webcrypto.md
872876
[`--experimental-global-customevent`]: cli.md#--experimental-global-customevent
873877
[`--experimental-global-webcrypto`]: cli.md#--experimental-global-webcrypto

0 commit comments

Comments
 (0)
Please sign in to comment.