Is an Object with a Property in my Array?
JavaScriptThe following code can be used to test whether an object in an 'array' array has a 'property' property with the value 'value':
// test if a object located in 'arrray' has a 'property' which equals 'value'
var isInArray = function (array, property, value) {
for (var i=0; i < array.length; i++) {
if (array[i][property] === value) return true;
}
return false;
};