数据处理工具类
// 数组对象去重
const duixiangquchong = (array = []) => {
return array.reduce((arr, cur) => {
let arrIds = arr.map((i) => i.id);
return arrIds.includes(cur.id) ? arr : [...arr, cur];
}, []);
};
//求和
let a = [1, [2, 3, [3, 4]]];
a.flat(Infinity).reduce((t, c) => t + c);