Update reject.md
This commit is contained in:
@ -3,9 +3,9 @@ title: reject
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Filters an array's values based on a predicate function, returning only values for which the predicate function returns `true`.
|
||||
Filters an array's values based on a predicate function, returning only values for which the predicate function returns `false`.
|
||||
|
||||
Use `Array.prototype.filter()` in combination with the predicate function, `pred`, to return only the values for which `pred()` returns `true`.
|
||||
Use `Array.prototype.filter()` in combination with the predicate function, `pred`, to return only the values for which `pred()` returns `false`.
|
||||
|
||||
```js
|
||||
const reject = (pred, array) => array.filter((...args) => !pred(...args));
|
||||
|
||||
Reference in New Issue
Block a user