Last active
July 19, 2016 12:36
-
-
Save YurePereira/c0cb4a4c1ab05c2251f5b0c405c1df46 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
| /** | |
| * Verifica se determinado valor (value) está dentro de um determinado Array (Vector). | |
| * | |
| * @param value Any Valor a ser pesquisado. | |
| * @param vector Array Vetor onde será pesquisado um valor passado por parâmetro. | |
| */ | |
| function inArray(value, vector) { | |
| var count = 0, | |
| length = vector.length; | |
| for (var i = 0; i < length; i++) { | |
| count += value == vector[i] ? 1 : 0; | |
| } | |
| return count > 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment