js remove object from array by property code example
Example 1: js remove object from array by value
let originalArray = [
{name: 'John', age: 23, color: 'red'},
{name: 'Ann', age: 21, color: 'blue'},
{name: 'Mike', age: 13, color: 'green'}
];
let filteredArray = originalArray.filter(value => value.age > 18);
Example 2: remove object from array of objects based on object property javascript
var myArray = [
{field: 'id', operator: 'eq', value: id},
{field: 'cStatus', operator: 'eq', value: cStatus},
{field: 'money', operator: 'eq', value: money}
];
myArray = myArray.filter(function( obj ) {
return obj.field !== 'money';
});
Example 3: how to delete object property of array javascript
array.forEach(function(v){ delete v.bad });