how we can delete particular object in array code example
Example 1: how to remove a specific object from an array javascript
var arr = [{id:1,name:'serdar'}, {id:2,name:'alfalfa'},{id:3,name:'joe'}];
removeByAttr(arr, 'id', 1);
removeByAttr(arr, 'name', 'joe');
Example 2: locate and delete an object in an array
var people = [
{name: 'Billy', age: 22},
{name: 'Sally', age: 19},
{name: 'Timmy', age: 29},
{name: 'Tammy', age: 15}
];
_.remove(people, function(e) {
return e.age < 21
});
console.log(people);