JavaScript 中的2种for循环
for 循环
1.循环时,循环的元素是索引
a = [11,22,33,44]
for( var item in a){
console.log(item);
}
字典循环是循环的key
a = {'k1':'v1','k2':'v2'}
for( var item in a){
console.log(item);
}
2.
for (var i=0;i<10;i++){
}
a = [11,22,33,44]
for(var i=0;i<a.length;i=i+1){
}
不支持字典循环