I have an array of objects
let people = [{
Name: 'Bob',
Age: '45',
},
{
Name: 'Jim',
Age: '45',
}
];
let person = people.filter(person => person.Name=== 'Bob')
This returns Bob but how do I delete him?
This only seems to delete a property
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
so it seems I need an index or maybe there is a better ES6 way?
splice()??let person = people.filter(person => person.Name!== 'Bob'). Filter will only return elements that return false to your condition and ignore the others.