I have this array:
var myArray = [{state: {name: 'object #1'}},
{state: {name: 'object #2'}},
{state: {name: 'object #3'}}];
I'm trying to remove with lodash the object where state.name is 'object #1'. Currently I'm doing it like this:
_.remove(myArray, {
name: 'object #1'
});
But it's not working. Initially I tried it like this, which for me is the more obvious way of doing it:
_.remove(myArray, {
state.name: 'object #1'
});
But it didn't worked either and my JS validator complained about the dot notation in there.
How do you do this in lodash?
{} !== {}!Array.prototype.splice()to remove element from an array.