Commit 6ebb034
committed
fix(forEach): fix a temporal dead zone issue in forEach.
According to the ES6 spec and the implementation in V8, accessing a
lexically scoped construct like const or let its declaration has
finished is a ReferenceError. Unlike var, it is not implicitly undefined
in the entire function scope. Because the closure handed to subscribe is
immediately invoked and accesses `subscription` before it is assigned,
this causes a ReferenceError in compliant engines.
The error is only triggered when running in plain ES6, i.e. without
transpilation.1 parent e2696db commit 6ebb034
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
| |||
0 commit comments