Created
December 13, 2009 15:56
-
-
Save ejknapp/255466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Searching An Array | |
| 1. A for loop that loops through the array | |
| for (index = 0; index < numbers.length; index++) { | |
| 2. An "if" statement that compare the current element in the array with the value I'm searching for. | |
| if (search === numbers[index]) | |
| 3. A boolean variable to indicate that I've found something. | |
| var valueFound = false; | |
| 4. Set the boolean variable to true if when we find our value. | |
| valueFound = true; | |
| 5. Then break out of the loop. This will leave the index set at the current element in the array. | |
| 6. An "if" statement for valueFound. | |
| if (valueFound) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment