I am getting error here:
export const checkSpam = (text, spamKeywords) => { const a = text.toLowerCase(); for (let i = 0; i < spamKeywords.length; i++) { if (a.includes(spamKeywords[i].toLowerCase())) { return true } return false } }
salmankhawar you analyze only the first string in the array spamKeywords. What should happen if your string doesn't include the spamKeywords[0]?
spamKeywords
spamKeywords[0]
HINT: Move the return false to a better location.
return false
Unable figure out how to run another iteration in the loop to check for the next word.
This is another method I did: ```export`` const checkSpam = (text, spamKeywords) => { const a = text.toLowerCase().split(' '); for (let i = 0; i < spamKeywords.length; i++)
{ return (a.includes(spamKeywords.toLowerCase())) } }
salmankhawar you don't need to figure out "how to run the next iteration". You need to figure out why/how you stop running it and why you exit the loop that hasn't been completed.
The key here is the return keyword.
return