find()
find<
T
>(predicate
): (arr
) =>undefined
|null
|T
Returns the first element of the given array that satisfies the predicate. Returns null
otherwise.
Type Parameters
• T
Parameters
predicate
Predicate
<T
>
A predicate function to apply to each element of the array.
Returns
Function
Parameters
arr
T
[]
Returns
undefined
| null
| T
Remark
pure function
Example
find(x => !(x & 1))([1, 2, 3, 4, 5]);
// 2