8 pts Create a function that returns the index of a given value (value) in a given array (arr) of integers. If the value (value) is not present in the array (arr), return -1. Example: passing [1,2,3,4,5] and 4 should return 3 (the index of 4 in the given array). You can assume the array (arr) will contain at least one value.
function valueIndex(arr, value){ //enter your code below }
Test Cases:
  • valueIndex([2,4,6,8], 4) to return 1
  • valueIndex([1,3,5,7,9], 1) to return 0
  • valueIndex([1,2,3,4,5], 6) to return -1
00:00 / 00:35

Share the mistake you found and we’ll fix as soon as we can.