arr:数组,type:根据那个属性来过滤
function unique(arr, type) {
const res = new Map();
return arr.filter((a) => !res.has(a[type]) && res.set(a[type], 1));
}
arr:数组,type:根据那个属性来过滤
function unique(arr, type) {
const res = new Map();
return arr.filter((a) => !res.has(a[type]) && res.set(a[type], 1));
}