从js数组重查找出重复元素的方法
2024-05-18 11:40:27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Array.prototype.duplicate=function() {

let tmp = [];

this.concat().sort().sort(function(a,b){

if(a==b && tmp.indexOf(a) === -1) tmp.push(a);

});

return tmp;

}