Created
August 21, 2012 15:32
-
-
Save neoswf/3416628 to your computer and use it in GitHub Desktop.
Find matches in two arrays
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
mainList = [-11, -1, 1, 2, 3, 4, 5]; | |
toSearchList = [-1, 1, 4, 6]; | |
document.write('Indexs inside mainList: '); | |
for (var i = 0; i < mainList.length; i++) { | |
for (var y = 0; y < toSearchList.length; y++) { | |
if(mainList[i] == toSearchList[y]){ | |
document.write(i + ', '); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment