var arr = [
{id:1,name:'zhang‘},
{id:1,name:'zhang'},
{id:3,name:'hu'},
{id:4,name:'jiao'}
]
const map = new Map()
var newArr = arr.filter(v=>!map.has(v.id) && map.set(v.id,v))
console.log("去重后的数组",newArr)
数组对象去重
于 2024-03-15 15:50:58 首次发布