Which method returns the index of the first occurrence of a value in an array?

JavaScript Associate Easy

JavaScript Associate — Easy

Which method returns the index of the first occurrence of a value in an array?

Key points

  • indexOf() returns the first index of the value found in the array.
  • find() returns the value itself, not the index.
  • findIndex() returns the index based on a condition, not a specific value.

Ready to go further?

Related questions