30 seconds of code

  Back to Home



Filters an array's values based on a predicate function, returning only values for which the predicate function returns true.

Use Array.prototype.filter() in combination with the predicate function, pred, to return only the values for which pred() returns true.

const reject = (pred, array) => array.filter((...args) => !pred(...args));