代码:
a = ['2',22,'cc']
for (var item in a){
console.log(a[item]);//循环的是索引号!
}
0
1
2
for (var i=0;i<a.length;i++){
console.log(i);
}
0
1
2
代码:
a = ['2',22,'cc']
for (var item in a){
console.log(a[item]);//循环的是索引号!
}
0
1
2
for (var i=0;i<a.length;i++){
console.log(i);
}
0
1
2