Returns the index of the first element satisfying the testing function.
Syntax
arr.findIndex(callbackFn)Example
Enter values below to update the example in real time.
const→numbers→idx→findIndex→console→const numbers = [10, 20, 30, 40];
const idx = numbers.findIndex((n) => n > 25);
console.log(idx); // 2