Searching for an index

Report a typo

In the code below an array of several numbers is given to the search() function. Change it so that the function returns the index of the element that equals 42, starting from the third element.

Sample Input 1:

2 42 4 6 42 8

Sample Output 1:

4
Write a program in JavaScript
function search(numbers) {
// Write your code here
}
___

Create a free account to access the full topic