boucle let/var

const arr = [];
for (var i=0; i < 3; i++) {
    arr.push(() => i);
}

console.log(arr.map(f => f()));

const arrL = [];
for (let i=0; i < 3; i++) {
    arrL.push(() => i);
}

console.log(arrL.map(f => f()));
JS Bin on jsbin.com