//获取数组重复的元素
function refrain(arr) {
  var tmp = [];
  if(Array.isArray(arr)) {
    arr.concat().sort().sort(function(a,b) {
      if(a==b && tmp.indexOf(a) === -1) tmp.push(a);
    });
  }
  return tmp;
}
 
posted on 2018-08-28 16:51  阿梅M  阅读(10012)  评论(0编辑  收藏  举报