数组对象去重

let obj = {};
const data2 = res.reduce((total, currentValue) => {
    obj[currentValue.workNumber] ? '' : obj[currentValue.workNumber] = true && total.push(currentValue);
    return total
}, [])
posted @ 2021-07-14 14:26  Met、life  阅读(35)  评论(0)    收藏  举报