js数组去重,删除重复的属性值

let a=[]

let hash={}

a=a.reduce((pre,next)=>{

hash[next.name]?"":(hash[next.name]=true&&pre.push(next));

return pre;

},[[]])

posted @ 2021-12-27 15:11  前端张大碗  阅读(69)  评论(0编辑  收藏  举报