Courses / JavaScript
54. Array.prototype.findIndex()
Returns the index of the first element in the array that satisfies the provided testing function.
1 min read Chapter 54 of 99
JavaScript
Array.prototype.findIndex()
findIndex() helps you locate the position of an item in an array based on a condition.
"I often need to find where a specific element is in a list, but searching manually is tedious."
The `findIndex()` method returns the index of the first element in an array that satisfies a testing function, or -1 if no elements match.
"I often need to find where a specific element is in a list, but searching manually is tedious."
The `findIndex()` method returns the index of the first element in an array that satisfies a testing function, or -1 if no elements match.