Array.prototype.removeCount=function(){
var that=this;
var arr=[];
for(var i=0;i<that.length;i++){
for(var j=i+1;j<that.length;j++){
var count=0;
if(that[i]==that[j]){
if(count==0){
arr.push(that.slice(j,j+1)[0]);
}
count++;
}
}
}
return arr;
}
console.log([1,2,2,3,3,5,7,9,0,9,0,11,‘a‘,‘b‘,‘a‘].removeCount());
时间: 2024-10-28 15:40:34