代码笔记
Blog icon0xb2
Feb 23
//判断数组中对象的值是否有相同的 let arr = [ {id:1,name:2,age:3}, {id:2,name:3:age:24}, {id:1,name:5,age:6} ] const ids = arr.map(value=>value.id); const idsSet = new Set(ids); if(idsSet.size() == ids.length){ console.log(“不存在同个值”) }else{ console.log(“存在同个值”) }

Most popular by 0xb2

ACG钢琴谱

ACG钢琴谱

0xb2

Written by
0xb2

https://mirror.xyz/0xDca228d5C3b3103CDD867AB4405322235B45fFC4/AGmrlrdEbGPy4Q6vMt5MrYn4RuwEXQ5dxOVxZBIa4AE

Subscribe

2025 Paragraph Technologies Inc

PopularTrendingPrivacyTermsHome
Search...Ctrl+K

0xb2

Subscribe