数组对象去重
2019-08-27 本文已影响0人
蜗牛Coming
var obj = {};
let newarray = arr.reduce((cur,item) => {
obj[item.id]?'':obj[item.id] = true && cur.push(item);
return cur;
},[])
var obj = {};
let newarray = arr.reduce((cur,item) => {
obj[item.id]?'':obj[item.id] = true && cur.push(item);
return cur;
},[])