SOURCE

var a = [];
for (let i = 0; i < 10; i++) {
    a[i] = function () {
        console.log(i);
    };
}
a[6]();
console 命令行工具 X clear

                    
>
console