Skip to main content

remove

_.remove(predicate, array) # Ⓢ [Ⓣ][1] Ⓝ

Removes all elements from array that predicate returns truthy for



and returns an array of the removed elements. The predicate is invoked



with three arguments: (value, index, array).






to pull elements from an array by value.

Since​

2.0.0

Arguments​

  1. predicate (Function): The function invoked per iteration.
  2. array (Array): The array to modify.

Returns​

(Array): Returns the new array of removed elements.

Example​

var array = [1, 2, 3, 4];
var evens = _.remove(function (n) {
return n % 2 == 0;
}, array);

// => [1, 3]