Array.indexOf

Easy
10
79.4% Acceptance

In this coding challenge, you will be implementing a function called findIndexOf(array, value) that takes two arguments: an array and a value. The function should return the index of the first occurrence of the value in the array.

Instructions

  • If no element is found, return -1.

Example test cases

findIndexOf([1, 2, 3], 2); // Output: 1 findIndexOf(['foo', 'bar', 'baz'], 'baz'); // Output: 2

Hints

  • You can use the built-in method .indexOf() directly on the input array.