UNPKG

553 BJavaScriptView Raw
1"use strict";
2var arr = [];
3
4// fresh x per iteration so can't be transformed
5// note v8 bug https://code.google.com/p/v8/issues/detail?id=2560
6// also see other/v8-bug.js
7for (let x = 0; x < 10; x++) {
8 arr.push(function() { return x; });
9}
10
11// fresh y per iteration so can't be transformed
12for (var x = 0; x < 10; x++) {
13 let y = x;
14 arr.push(function() { return y; });
15}
16
17// fresh x per iteration so can't be transformed
18for (let x in [0,1,2]) {
19 arr.push(function() { return x; });
20}
21
22arr.forEach(function(f) {
23 console.log(f());
24});