Solution Review: Search First Occurrence of a Number
This review provides a detailed analysis for finding the first occurrence of a given number in an array.
We'll cover the following...
We'll cover the following...
Solution #1: Iterative Method
Explanation
To find the first occurrence of testVariable we iterate over the entire array and return the currentIndex when testVariable is found. Let’s look at an illustration: