findIndex()
findIndex<
T
>(predicate
): (arr
) =>number
Returns the first index of the given array that satisfies the predicate. Returns -1
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
number
Remark
pure function
Example
findIndex(x => !(x & 1))([1, 2, 3, 4, 5]);
// 1