标签:数组去重 for var length ++ pre 数组 obj 去重
var ary=[12,23,67,23,6,7,8,12]
var obj={};
for(var i=0;i<ary.length;i++){
var cur=ary[i];
if(obj[cur]===cur){
ary[i]=ary[ary.length-1];
i--;
ary.length--;
}
obj[cur]=cur;
}
标签:数组去重 for var length ++ pre 数组 obj 去重
原文地址:http://www.cnblogs.com/dou1234/p/7349693.html