The following method seems a little naive to me so I am wondering if there is a better way to do this. 2 arrays are involved and they contain objects which I have to compare by a certain property:
function exists(objArray, id) {
var isFound = false;
objArray.forEach(obj => {
if (obj.Id == id)
isFound = true;
});
return isFound;
}
var array1, array2;
array1.forEach(obj => exists(array2, obj.Id));