Js determines whether there is a value in the object of the array

const arr=[
{id:1,name:"a"},
{id:2,name:"b"},
{id:3,name:"c"}
]

how can I easily judge whether id exists in arr or not?

May.22,2021

arr.some(({id})=>id==2)
Menu