Check if an array contains an object with a certain property value in JavaScript?
//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.