xxxxxxxxxx
//If you need to modify the existing Array, you should use splice().
for (var i = array.length - 1; i > -1; i--) {
if (array[i].name === "zipCode")
array.splice(i, 1);
}
//Notice that I'm looping in reverse. This is in order to deal with the fact that when
//you do a .splice(i, 1), the array will be reindexed.
//If we did a forward loop, we would also need to adjust i whenever we do a .splice()
//in order to avoid skipping an index.
xxxxxxxxxx
myArray.some(obj => obj.property === 'value')
// returns true or false
xxxxxxxxxx
if (vendors.filter(e => e.Name === 'Magenic').length > 0) {
/* vendors contains the element we're looking for */
}
xxxxxxxxxx
const magenicVendorExists = vendors.reduce((accumulator, vendor) => (accumulator||vendor.Name === "Magenic"), false);