题目
下面代码的输出是什么?
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
for (let i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
A.0 1 2 and 0 1 2
B. 0 1 2 and 3 3 3
C. 3 3 3 and 0 1 2
下面代码的输出是什么?
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
for (let i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1);
}
A.0 1 2 and 0 1 2
B. 0 1 2 and 3 3 3
C. 3 3 3 and 0 1 2
帖子还没人回复快来抢沙发