Skip to content

Commit 39d52ca

Browse files
bmecktrevnorris
authored andcommitted
Correct technicality of what this is in module
Correct spec about what ECMA262 sets `this` to in modules. Thanks to @thomasboyt PR-URL: nodejs#29 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent 2272a81 commit 39d52ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

002-es6-modules.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,13 @@ packages, some people may prefer to exclude main entirely in the case of using
425425

426426
### 5.3. `this` in ES modules
427427

428-
ES modules will have a `this` value set to the global scope. This
428+
ES modules will have a `this` value set to `undefined`. This
429429
is a breaking change. CJS modules have a `this` value set to their `module`
430430
binding.
431431

432-
See ECMA262's [ModuleEvaluation]
433-
(https://tc39.github.io/ecma262/#sec-moduleevaluation) for this semantic.
432+
See ECMA262's [Module Environment Record](
433+
https://tc39.github.io/ecma262/#sec-module-environment-records-getthisbinding
434+
) for this semantic.
434435

435436
### 5.4. ES consuming CommonJS
436437

0 commit comments

Comments
 (0)