数组属性去重

  //去重复
    unique(arr1) {
      const res = new Map();
      return arr1.filter((a) => !res.has(a.level) && res.set(a.level, 1))
    },
    uniqueFun(arr, type) {
      const res = new Map();
      return arr.filter((a) => !res.has(a[type]) && res.set(a[type], 1));
    }

https://blog.csdn.net/weixin_42232156/article/details/121822723

https://blog.csdn.net/m0_64564920/article/details/124056295

posted @ 2021-09-04 12:34  寒冷的雨呢  阅读(32)  评论(0编辑  收藏  举报