I have an array of characters I am testing another array against. The array of strings length can dynamically change every time the app is ran. Here is the code I have, but right now it is just going through the first index of the array. How can I have it go through all the length of the array toTest
code:
var testAgainst = ['and','+',',','&'];
var toTest = ['This is just a test +','This is just a test and','This is just a test ,','This is just a test &','This is just a test'];
for(var i = 0; i < testAgainst.length; i++){
if (toTest[0].indexOf(testAgainst[i]) > -1){
console.log('match: ' + testAgainst[i]);
}else{
console.log('no match');
}
}
JSFIDDLE: https://jsfiddle.net/bmpgsxb2/2/