Skip to main content

negate

_.negate(predicate) # Ⓢ [Ⓣ][1] Ⓝ

Creates a function that negates the result of the predicate func. The



func predicate is invoked with the this binding and arguments of the



created function.

Since​

3.0.0

Arguments​

  1. predicate (Function): The predicate to negate.

Returns​

(Function): Returns the new negated function.

Example​

function isEven(n) {
return n % 2 == 0;
}

_.filter(_.negate(isEven), [1, 2, 3, 4, 5, 6]);
// => [1, 3, 5]