fix(forEach): fix a temporal dead zone issue in forEach. (#2474)
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.
trxcllnt/RxJS,RxJS-CN/RxJS-Docs-CN,benlesh/RxJS,kwonoj/RxJS,IgorMinar/RxJS,jayphelps/rxjs,jayphelps/rxjs,trxcllnt/RxJS,martinsik/rxjs,ReactiveX/rxjs,SangKa/RxJS-Docs-CN,Brocco/RxJS,martinsik/rxjs,SangKa/RxJS-Docs-CN,ReactiveX/rxjs,ReactiveX/RxJS,ReactiveX/RxJS,ReactiveX/RxJS,jayphelps/rxjs,jayphelps/rxjs,trxcllnt/RxJS,RxJS-CN/RxJS-Docs-CN,SangKa/RxJS-Docs-CN,kwonoj/RxJS,kwonoj/RxJS,Brocco/RxJS,RxJS-CN/RxJS-Docs-CN,ReactiveX/RxJS,SangKa/RxJS-Docs-CN,benlesh/RxJS,IgorMinar/RxJS,jayphelps/rxjs,RxJS-CN/RxJS-Docs-CN,martinsik/rxjs,ReactiveX/rxjs,ReactiveX/rxjs,trxcllnt/RxJS,Brocco/RxJS,martinsik/rxjs,kwonoj/RxJS,benlesh/RxJS,benlesh/RxJS,Brocco/RxJS