var value1 = 0,value2 = 0,value3 =0;
for(var i = 1;i<=3 ;i++){ var i2 = i; (function(){ var i3 = i; setTimeout(function(){ value1 += i; value2 += i2; value3 += i3; },1) })()}setTimeout(function(){ console.log(value1,value2,value3)},100)
本文共 291 字,大约阅读时间需要 1 分钟。
var value1 = 0,value2 = 0,value3 =0;
for(var i = 1;i<=3 ;i++){ var i2 = i; (function(){ var i3 = i; setTimeout(function(){ value1 += i; value2 += i2; value3 += i3; },1) })()}setTimeout(function(){ console.log(value1,value2,value3)},100)
转载于:https://www.cnblogs.com/studyh5/p/10008239.html