1var colors = ["red","blue","green","green"];
2var greens = _.remove(colors, function(c) {
3 return (c === "green"); //remove if color is green
4});
5//colors is now ["red","blue"]
6//greens is now ["green","green"]
1var arr = [1, 2, 3, 3, 4, 5];
2_.remove(arr, function(e) {
3 return e === 3;
4});
5console.log(arr);
1var array = [1, 2, 3, 4];var evens = _.remove(array, function(n) { return n % 2 === 0;});console.log(array);// => [1, 3]console.log(evens);// => [2, 4]