How to check if all objects in an array of objects contains a key value pair.
For example consider this array = arr=[{name:'one',check:'1'},{name;'two',check:'0.1'},{name:'three',check:'0.01'}]
the below function returns true if atleast the check value is present in one object of array otherwise false. `
function checkExists(check,arr) {
return arr.some(function(el) {
return el.check === check;
});
}
`
But I need to check and return true only if all the objects in the array contain that check value otherwise false.
How to do this?