firstIndex() Function
Returns the first index in array
whose value satisfies the predicate
.
Signature
export declare function firstIndex<T>(array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => boolean): number;
Parameters
Parameter | Type | Description |
---|---|---|
array | readonly T[] | The array to search. |
predicate | (value: T, index: number, array: readonly T[]) => boolean | A predicate. There should exist some index |
(Returns) | number | The first index in |