javascript array of objects remove property code example
Example 1: 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 2: how to remove a property from an object in javascript
var person = {
name: "Harry",
age: 16,
gender: "Male"
};
delete person.age;
alert(person.age);
console.log(person);
Example 3: javascript remove object element
delete object.element;
Example 4: how to delete object property of array javascript
array.forEach(function(v){ delete v.bad });