标签:log his i++ ++i ons prototype cti type 数组去重
Array.prototype.quchong = function(){
var arr = this,
len = arr.length,
b = [],
i,
j;
for(var i=0;i<len;i++){
for(var j=i+1;j<len;j++){
if(arr[i]===arr[j]){
j = ++i;
}
}
b.push(arr[i]);
}
return b;
}
a = [1,2,3,2,1,4];
console.log(a.quchong())
标签:log his i++ ++i ons prototype cti type 数组去重
原文地址:https://www.cnblogs.com/wcongrantulion/p/9060145.html