[Solved] Why is this for loop looping through the array 4 times?


You have write a for loop from testAgainst and testAgainst.length === 4 that’s why it loops 4 times on toTest

You algorithm is good. I don’t see any other possibilities, maybe by using regexp but it depends what you want to do

solved Why is this for loop looping through the array 4 times?