how to find index of element in array and remove javascript code example
Example: 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);
// Output
// [ { name: 'Billy', age: 22 }, { name: 'Timmy', age: 29 } ]