for (let i = 0; i < 5; i++) {
a[i] = function() {
console.log(i)
}
a[2]() //2
i为什么不是undefined,for循环里面我只是创建了一个函数,为什么我执行a[2]的时候还是能拿到i的值
手掌心
相关分类