filter()
filter<
T
>(predicate
): (arr
) =>T
[]
Returns a copy of the given array of elements that satisfy the predicate.
Type Parameters
• T
Parameters
predicate
Predicate
<T
>
A predicate function to apply to each element of the array.
Returns
Function
Parameters
arr
T
[]
Returns
T
[]
Remark
pure function
Example
filter(x => !(x & 1))([1, 2, 3, 4, 5]);
// [2, 4]