对象的数组去重

 

去掉type相同的

unique(arr) {
  const res = new Map();
  return arr.filter((arr) => !res.has(arr.type) && res.set(arr.type, 1));
},

posted @ 2020-07-08 10:37  喆星高照  阅读(79)  评论(0编辑  收藏  举报