0

indexOf

Hello wizards. Could you tell me, what is my mistake? Why check works only if the string begins with a bad word? https://code.sololearn.com/WvhK1jRWMW1G/?ref=app

21st Dec 2017, 6:58 PM
Bogdan Saliuk
Bogdan Saliuk - avatar
1 Odpowiedź
+ 2
you must parse the string, str = str.replace(/#|_/g, " "); var listWord = str.split(" "); and then iterate the list word with this condition: if (spam.indexOf(listWord[i]) == -1)
22nd Dec 2017, 2:52 AM
Arif R Nas
Arif R Nas - avatar