I want to check if value exist in array object, example:
I have this array:
[ {id: 1, name: \'foo\'}, {id: 2, name: \'bar\'}, {id: 3, nam
You can use find method as below
var x=[ {id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'test'} ] var target=x.find(temp=>temp.id==2) if(target) console.log(target) else console.log("doesn't exists")