I am trying to determine if ANY value from one array matches ANY value from another array. The problem that i am having is that if there are two values in my array and the first value is found but the second is not found, my indicator is coming up as FALSE when i need it to return TRUE. Here is some example code that i'm working with:
var itemArray = ['apples','bananas','cherries'];
var categoryArray = ['donuts','cherries','eclairs','fruit','grapes'];
for(var z=0; z<itemArray.length; z++){
for(var y=0; y<categoryArray.length; y++){
if(itemArray[z] == categoryArray[y]) var isInArray = true;
else var isInArray = false;
}
}
alert(isInArray);
Appreciate the help, let me know if more information is needed.