Hello, i get 2 error with this task:
2.checkSpam should return true if the match is found
4.checkSpam should make case insensitive match
even if the result is correct (false and true).
I've tried 2 different functions:
1)
export const checkSpam = (text, spamKeywords) => {
const s = text.toLowerCase();
for (let i = 0; i < spamKeywords.length; i++) {
let substring = spamKeywords[i].toLowerCase();
if (s.indexOf(substring) != -1) {
return true;
}
return false;
}
}`
2)
`export const checkSpam = (text, spamKeywords) => {
const s = text.toLowerCase();
for (let i = 0; i < spamKeywords.length; i++) {
return s.includes(spamKeywords[i]);
}
}
but the result is always the same (correct for the result task but with 2 errors).
What i'm doing wrong?
Thanks