Skip to content

Commit 226573b

Browse files
authored
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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent a845f21 commit 226573b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

doc/api/globals.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,12 @@ added: v0.1.27
513513
514514
* {Object} The global namespace object.
515515

516-
In browsers, the top-level scope is the global scope. This means that
517-
within the browser `var something` will define a new global variable. In
518-
Node.js this is different. The top-level scope is not the global scope;
519-
`var something` inside a Node.js module will be local to that module.
516+
In browsers, the top-level scope has traditionally been the global scope. This
517+
means that `var something` will define a new global variable, except within
518+
ECMAScript modules. In Node.js, this is different. The top-level scope is not
519+
the global scope; `var something` inside a Node.js module will be local to that
520+
module, regardless of whether it is a [CommonJS module][] or an
521+
[ECMAScript module][].
520522

521523
## Class `Headers`
522524

@@ -982,6 +984,8 @@ added: v18.0.0
982984
983985
A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
984986

987+
[CommonJS module]: modules.md
988+
[ECMAScript module]: esm.md
985989
[Web Crypto API]: webcrypto.md
986990
[`--no-experimental-fetch`]: cli.md#--no-experimental-fetch
987991
[`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent

0 commit comments

Comments
 (0)