ITeye博客

JS中数组遍历切忌 for in

lvmy · 2013-06-07 11:18 · JavaScript · Web前端 · prototype · JavaScript · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。