js数组对象去重

const removeDuplicateObj = (arr) => {
          let obj = {};
          arr = arr.reduce((newArr, next) => {
            obj[next.shopId] ? "" : (obj[next.shopId] = true && newArr.push(next));
            return newArr;
          }, []);
          return arr;
        };

        console.log(removeDuplicateObj(arr0));

你可能感兴趣的:(javascript,开发语言,ecmascript)