GeezerVison is showing github.com — doc: update description of global · nodejs/node@13118a1
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/globals.md +8-4Lines changed: 8 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -513,10 +513,12 @@ added: v0.1.27 |
513 | 513 |
|
514 | 514 | * {Object} The global namespace object. |
515 | 515 |
|
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][]. |
520 | 522 |
|
521 | 523 | ## Class `Headers` |
522 | 524 |
|
@@ -982,6 +984,8 @@ added: v18.0.0 |
982 | 984 |
|
983 | 985 | A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. |
984 | 986 |
|
| 987 | +[CommonJS module]: modules.md |
| 988 | +[ECMAScript module]: esm.md |
985 | 989 | [Web Crypto API]: webcrypto.md |
986 | 990 | [`--no-experimental-fetch`]: cli.md#--no-experimental-fetch |
987 | 991 | [`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent |
|