I am getting error while submitting, even though it returns false / true as expected. Pls. guide / help.
. checkSpam should return true if the match is found
checkSpam should make case insensitive match
Here is my code:
export const checkSpam = (text, spamKeywords) => {
let i = 0;
while (i < spamKeywords.length) {
if (text.toLowerCase().includes(spamKeywords[i].toLowerCase())) {
i++;
return true;
}
else {
return false;
}
}
}