Returns the index of the first occurrence of a value in an array.
Returns -1 if the value is not found.
-1
indexOf(1)([1, 2, 3]); // => 0indexOf(1)([2, 3]); // => -1 Copy
indexOf(1)([1, 2, 3]); // => 0indexOf(1)([2, 3]); // => -1
Optional
Returns the index of the first occurrence of a value in an array.
Returns
-1
if the value is not found.Example