I have an array that looks like this:
var myArray = [
{'id' : 1, 'name' : 'test1'},
{'id' : 2, 'name' : 'test2'},
{'id' : 3, 'name' : 'test3'}
];
Then I have a variable that contains some id:
var someId = 2;
How can I check if myArray
contains an Object
, who's id is equal to someId
?