对数组内多个对象的去重
let Result
= []
let Obj
= {}
for(let i
= 0; i
< array
.length
; i
++){
if(!Obj
[array
[i
].key
]){
Result
.push(array
[i
])
Obj
[array
[i
].key
] = true
}
}
console
.log(Result
)
注意:简单记录,没有罗列其它简单去重、深度去重的方法
转载请注明原文地址: https://win8.8miu.com/read-3374.html