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 Array.prototype.some
var a = [ {id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'test'} ]; var isPresent = a.some(function(el){ return el.id === 2}); console.log(isPresent);