findIndex
findIndex() function
Returns the index of the first element of Iterable/AsyncIterable which matches f, or -1 if no element matches.
Signature:
declare function findIndex<T extends readonly []>(f: Arrow, iterable: T): -1;
Returns:
-1
Example
const arr = [{a:1}, {a:2}, {a:3}]
findIndex((obj) => obj.a === 1, arr); // 0
findIndex((obj) => obj.a === 2, arr); // 1
findIndex((obj) => obj.a === 4, arr); // -1