export function removeRepeatKeyInArr(arr) {
let map = new Map();
for (let item of arr) {
if (!map.has(item.id)) {
map.set(item.id, item);
}
}
// console.log('map', map);
return [...map.values()];
}
JS去除数组中某个元素相同的元素
最新推荐文章于 2024-09-11 15:33:18 发布