Learn about the Array findIndex method in JavaScript

Find an item in an array with the ‘findIndex’ method in JavaScript.

Photo by Gratisography from Pexels

The method returns the index of the first element of the array if the callback function passed to the method returns true, otherwise returns -1


  • → A function to execute on each value in the array until the function returns , indicating that the satisfying element was found.
  • → Optional object to use as when executing .

The takes three arguments

  • → current processing element
  • → index of the element processing
  • → array in which findIndex method called.


  • once the callback returns the index, it will not process the remaining elements.

Unlike other array methods such as , is run even for indexes with unassigned values.

Extras :

The method, which returns the value of an array element, instead of its index.

You can find the implementation details of method here.

Articles related to JavaScript.