What does `Array.prototype.findIndex()` return when no element matches the condition?

JavaScript Professional Easy

JavaScript Professional — Easy

What does `Array.prototype.findIndex()` return when no element matches the condition?

Key points

  • The return value of -1 signifies that the element is not present in the array.
  • This method does not return null, undefined, or false in such cases.
  • It is important to understand the specific return values of array methods like `findIndex()`.

Ready to go further?

Related questions