At the end I am essentially trying to achieve a lastIndexOf. I do that by reversing my array, using indexOf, and subtracting from 9. This adds 4 (
-) extra bytes to get from indexOf to lastIndexOf.
Furthermore, if I didn't know my array was length 10 the code would be even longer, and secondly, this code returns
10 when indexOf is
-1 which may not be acceptable in many situations.
Any suggestions on a shorter way to do the lastIndexOf operation (generally or just as needed for this challenge)?