JS中数组遍历切忌 for in
Array.prototype.test = 'test_prototype';
var arr = [1,2,3,4,5,6];
for (var i in arr){
console.log(i);
}
>>0
>>1
>>2
>>3
>>4
>>5
>>test
Array.prototype.test = 'test_prototype';
var arr = [1,2,3,4,5,6];
for (var i in arr){
console.log(i);
}
>>0
>>1
>>2
>>3
>>4
>>5
>>test
暂无评论。
评论功能维护中,当前仅展示历史评论。