Last active
June 18, 2020 23:08
-
-
Save viiiprock/3d3cd625492f06b47c440959fc0d7435 to your computer and use it in GitHub Desktop.
Algorithms
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
| const linearSearch = (value, inputArray) => { | |
| for (let i = 0; i < inputArray.length; ++i) { | |
| if (value === inputArray[i]) { | |
| return i | |
| } | |
| } | |
| return null | |
| } | |
| const Arr = [10, 14, 26, 27, 31, 33, 35, 42, 44] | |
| console.log(linearSearch(33, Arr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment