高效的数组去重(js)
function uniqueArray(data){
data = data || [];
var a = {};
for (var i=0; i<data.length; i++) {
var v = data[i];
a[v] = 1;
console.log(a)
};
data.length=0;
for (var i in a){
console.log(data.length)
data[data.length] = i;
}
console.log(data)
return data;
}
var arrData = [1,3,5,7,7,8,9,3,7,10,8];
uniqueArray(arrData);
耐得住寂寞,守得住繁华