diff options
author | Tobias Nießen <tniessen@tnie.de> | 2023-05-14 01:49:24 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2023-05-15 11:37:35 +0200 |
commit | 13118a19ee25f6e2fd29bcd4862300028c1e4101 (patch) | |
tree | b3a66aa67ce2cadeebcf586fa32fc08de47df30f | |
parent | c05c0a2359d8a4a6b19a00e1e9a73d585c095fa8 (diff) | |
download | node-new-13118a19ee25f6e2fd29bcd4862300028c1e4101.tar.gz |
doc: update description of global
With widespread support for ES modules, the description of global is
outdated now.
PR-URL: https://github.com/nodejs/node/pull/47969
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
-rw-r--r-- | doc/api/globals.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/api/globals.md b/doc/api/globals.md index dec10a5a4e..28aa352611 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -513,10 +513,12 @@ added: v0.1.27 * {Object} The global namespace object. -In browsers, the top-level scope is the global scope. This means that -within the browser `var something` will define a new global variable. In -Node.js this is different. The top-level scope is not the global scope; -`var something` inside a Node.js module will be local to that module. +In browsers, the top-level scope has traditionally been the global scope. This +means that `var something` will define a new global variable, except within +ECMAScript modules. In Node.js, this is different. The top-level scope is not +the global scope; `var something` inside a Node.js module will be local to that +module, regardless of whether it is a [CommonJS module][] or an +[ECMAScript module][]. ## Class `Headers` @@ -982,6 +984,8 @@ added: v18.0.0 A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. +[CommonJS module]: modules.md +[ECMAScript module]: esm.md [Web Crypto API]: webcrypto.md [`--no-experimental-fetch`]: cli.md#--no-experimental-fetch [`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent |