SyraTi / syra-ti.icu

MIT License
1 stars 0 forks source link

关于For循环中进行异步操作索引不正确的处理方式 | SyraTi.ICU #85

Open SyraTi opened 2 years ago

SyraTi commented 2 years ago

https://syra-ti.icu/665cae66e591.html

code 问题代码12345678function test() { for (var i = 0; i < 5; ++i) { setTimeout(function() { console.log("index is :", i); }, 1000); }&