← previousnext →
Problem
Return the index of target in arr, or -1 if it is not found.
Examples
linearSearch([4, 2, 7, 1], 7) -> 2linearSearch([1, 2, 3], 5) -> -1
Return the index of target in arr, or -1 if it is not found.
linearSearch([4, 2, 7, 1], 7) -> 2linearSearch([1, 2, 3], 5) -> -1