【JS】数组对象去重
const arrUnique = (arr, key) => {
let ojb = {};
return arr.reduce((pre, item) => {
ojb[item[key]] ? '' : ojb[item[key]] = true && pre.push(item);
return pre;
}, []);
};
const arrUnique = (arr, key) => {
let ojb = {};
return arr.reduce((pre, item) => {
ojb[item[key]] ? '' : ojb[item[key]] = true && pre.push(item);
return pre;
}, []);
};