Find matches in two arrays
by neoswf
JavaScript
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 + ', ');
}
}
}