I am trying to check if a string contains certain words which I had stored in an array... however I'm new to JS, so I don't exactly know how to check all of the elements inside the Array.
Here is an Example:
const fruits = ["apple", "banana", "orange"]
I am actually checking if someone sends swearwords in a chat.
if(message.content.includes(fruits)){executed code}
However my issue is when I check for fruits it does anything but when I check for a specific element in the array like fruits[0] //returns apple it will actually check for that...
So my issue / question is how do I check the string for all of the elements in the array not just apples.
message.contentis? Is it a string or is it an array? I sorta get the impression it is for example some comment a user posts in a thread, and you want to see if any of the words in your array are found within it, yes?