Fork me on GitHub

js根据指定字段数据去重

//根据id去重
function unique(arr1) {
const res = new Map();
return arr1.filter((a) => !res.has(a.id) && res.set(a.id, 1))
}

posted @ 2021-07-16 16:33  WantRemake  阅读(398)  评论(0编辑  收藏  举报