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
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)