indexOf() Example 1 indexOf() Example 1 This example defines an array [2,5,9] and then returns the indices of the number 2 (which is 0) and the number 7 (which is -1).
This example defines an array [2,5,9] and then returns the indices of the number 2 (which is 0) and the number 7 (which is -1).