I am trying to make a profanity filter. I have an array of bad words and if a user enters a message containing a bad word I want it to flag that message. I got everything working, but the filter also flags words that include parts of a bad word. Like 'Glass' containing the word 'ass'. I know I used the 'includes' method. But I want it to only become true if it is an exact match to a word in the filter array.
for (var i = 0; i < ProfanityFilter.length; i++)
if (message.toLowerCase().includes(ProfanityFilter[i]))
Is there a way to use something else?