一段从js数组中获取重复数据的代码

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; }

October 18, 2018 · 1 min · 17 words · 水华