转发一个前端数组去重的文章

https://segmentfault.com/a/1190000016418021?utm_source=tag-newest

function unique (arr) {
  return Array.from(new Set(arr))
}
var arr = [1,1,'true','true',true,true,15,15,false,false, undefined,undefined, null,null, NaN, NaN,'NaN', 0, 0, 'a', 'a',{},{}];
console.log(unique(arr))

谢谢老哥 

原文地址:https://www.cnblogs.com/notchangeworld/p/11792312.html