Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(forEach): fix a temporal dead zone issue in forEach. (#2474)
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.
- Loading branch information