Update negate.md
This commit is contained in:
@ -5,10 +5,7 @@ Negates a predicate function.
|
|||||||
Take a predicate function and apply `not` to it with its arguments.
|
Take a predicate function and apply `not` to it with its arguments.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const negate = func => (...args) => {
|
const negate = func => (...args) => !fun(...args);
|
||||||
return !func(...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
|
// filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5]
|
||||||
// negate(isOdd)(1) -> false
|
// negate(isOdd)(1) -> false
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user