Implement a reject
function similar to _.reject
from the Lodash library. The reject
function takes an array and a predicate function, and returns a new array that excludes all elements for which the predicate function returns truthy.
Requirements:
reject
.Example Usage:
const arr = [1, 2, 3, 4, 5]; const isEven = (num) => num % 2 === 0; const result = reject(arr, isEven); console.log(result); // [1, 3, 5]