如何通过新集合从对象中获取唯一数组?
我有一个包含对象的数组,如何获得唯一的数组,但只能保留 id?
IE:[{id: 1, title: 'test1'}, {id: 2, title: 'test2'}]
const arr = [{id: 1, title: 'test1'}, {id: 2, title: 'test2'}, {id: 1: title: 'test1'}]
const filtered = arr.filter((item) => item.title)
const result = Array.from(new set(arr))
 慕田峪4524236
慕田峪4524236 
					小怪兽爱吃肉
 
					Cats萌萌
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类