SOURCE

window.onload = () => {
    let arr = [];
    for(var i=0; i<10; i++)
    {
        arr.push(() => {
            console.log('var:'+i);
        });
    }

    arr[3]();

    let arr2 = [];
    for(let x=0; x<10; x++)
    {
        arr2.push(() => {
            console.log('let:'+x);
        })
    }

    arr2[3]();

    let arr3 = [];
    for(var y=0; y<10; y++)
    {
        window.onload = function(n){
                return arr3.push(() => {
                console.log('es5:'+n);
            })
        }(y)
    }

    arr3[3]();
}
console 命令行工具 X clear

                    
>
console