Last active
October 29, 2015 01:40
-
-
Save greemwahr/c15c73f3f9fe450f9d04 to your computer and use it in GitHub Desktop.
codeSnippet
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
/* Excellent piece of code to determine the index of a particular | |
element being searched.*/ | |
var indices = []; | |
var element = 0; | |
var idx = arrNum.indexOf(element); | |
// console.log(idx); | |
while (idx != -1) { | |
indices.push(idx); | |
idx = arrNum.indexOf(element, idx + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment