reject

reject(iterator[, context]) -> Array

Returns all the elements for which the iterator returned false.

The optional context parameter is what the iterator function will be bound to. If used, the this keyword inside the iterator will point to the object given by the argument.

Examples


$R(1, 10).reject(function(n) { return 0 == n % 2; })
// -> [1, 3, 5, 7, 9]

[ 'hello', 'world', 'this', 'is', 'nice'].reject(function(s) {
  return s.length >= 5;
})
// -> ['this', 'is', 'nice']

See also

The findAll method (and its select alias) are the opposites of this one. If you need to split elements in two groups based upon a predicate, look at partition.