indexOf looks through an array for an element with the same value as the argument passed to it. It will return the index of the element or -1 if it doesn’t find it.
Have you looked at the console? Console.log the last line.
indexOf expects a value to search for. What you are passing is conditional. Plus, what if you are given an array that is not sequential #'s starting at 1?
indexOf would have to be looping an array of true/false values which it isn’t.
If you really wanted that you can create an array of the values that the callback returns and then use indexOf on that array. You would then use the index indexOf returns to index into the array passed to the function. Not sure if that made any sense, it is kind of hard to explain.
This is pretty much what solution 3 on the hints page does. I do however find that approach hard to reason about, at least at first glance.