js数组去重就是把数组中重复的元素去掉:
Array.prototype.delRepeat=function(){
var newArray=new Array();
var len=this.length;
for (var i=0;i<len ;i++){
for(var j=i+1;j<len;j++){
if(this[i]===this[j]){
j=++i;
}
}
newArray.push(this[i]);
}
return newArray;
}
但是很明显这里有for循环内嵌了另一个for循环,在大数据量下肯定非常耗时!效率低下!经过查找和高人指点优化了一个新方法: 继续阅读:js数组去重»


最新评论
非常好
Post:2012-02-08 21:59:12@linda, 没见过世面吧你,老板才8 »
Post:2012-02-07 18:11:22码头哥,换个链接,http://www.ijo »
Post:2012-02-07 17:18:45currying: 科里化
Post:2012-02-06 15:51:18貌似在线api已经下不了了
Post:2012-02-06 11:25:19图片被防盗链了,哈哈~
Post:2012-02-06 10:29:45对你造成的不便非常抱歉,简易你卸 »
Post:2012-02-05 14:45:16您好,请问air版本的自动更新怎么去 »
Post:2012-02-05 12:06:24