Created
July 23, 2015 12:41
-
-
Save ihorkatkov/141795d02a20d76e2ad5 to your computer and use it in GitHub Desktop.
[JS] Поиск в массиве
This file contains 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
function find(arr, value) { | |
var i; | |
var searchFalse = -1; | |
for (i = 0; i<arr.length; i++) { | |
if (arr[i] === value) { | |
return i; | |
} | |
} | |
return searchFalse; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment