84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
目前除了使用a.shift()以及ES6中的let关键字,还有其他方法吗?方法一:
var i = 0;i < len; i++
a.shift();
方法二:
let i = 0;i < len; i++
a[i];
求更多方法
人生最曼妙的风景,竟是内心的淡定与从容!
var a = [1,2,3]; var len = a.length; for(var i = 0,j=0;i<len;i++){ setTimeout(function(){ console.log(a[j++]); }); }
var a = [1,2,3]; var len = a.length; for(var i=0; i<len; i++) { setTimeout(function() { console.log(a[len - i--]); }); }
for(var i=0; i<len; i++){(function(j){setTimeout(....)})(i);}
for(let item of a) { setTimeout(function() { console.log(item); }, 200); }
for(var i=0; i<len; i++){
(function(j){
setTimeout(....)
})(i);
}