// 序列化去重
const noRepeat = [...new Set(arr.map(item => JSON.stringify(item)))];
// 反序列化
const newArr = noRepeat.map(item => JSON.parse(item));
对象数组使用Set去重
最新推荐文章于 2024-08-15 15:27:27 发布
// 序列化去重
const noRepeat = [...new Set(arr.map(item => JSON.stringify(item)))];
// 反序列化
const newArr = noRepeat.map(item => JSON.parse(item));