Update reject.md

This commit is contained in:
刘家轶
2020-04-03 09:29:33 -05:00
committed by GitHub
parent 04e5ea8fc0
commit e16bcaef50

View File

@ -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));