数组数据去重

数据去重

indexOf

1
2
3
4
5
6
7
8
9
10
Array.prototype.unique1 = function() {
var arr = []
for(var i = 0; i< this.length; i++) {
vat item = this[i]
if(ar.indexOf(item) === -1) {
arr.push(item)
}
}
return arr
}

https://app.yinxiang.com/shard/s12/nl/3276207/55491842-8bf4-4c55-b88f-2766ad39475a

请我喝杯咖啡吧~