js 删除 数组重复
js删除数组重复
Array.prototype.unique = function() {
var a = {};
for (var i = 0; i < this.length; i++) {
if (typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for (var i in a)
this[this.length] = i;
return this;
}
完
js删除数组重复
Array.prototype.unique = function() {
var a = {};
for (var i = 0; i < this.length; i++) {
if (typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for (var i in a)
this[this.length] = i;
return this;
}
完