javascript delete object from array wirth find code example
Example 1: locate and delete an object in an array
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
apps.splice(removeIndex, 1);
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);