remove one array from another lodash code example
Example 1: lodash remove element from list
var colors = ["red","blue","green","green"];
var greens = _.remove(colors, function(c) {
return (c === "green"); //remove if color is green
});
//colors is now ["red","blue"]
//greens is now ["green","green"]
Example 2: lodash remove multiple items from array
var colors = ["red","blue","green","yellow"];
var removedColors = _.remove(colors, function(c) {
//remove if color is green or yellow
return (c === "green" || c === "yellow");
});
//colors is now ["red","blue"]
//removedColors is now ["green","yellow"]