My main objective is to check if the string contains array of words. If the string contain $ in front of a word, I don't want it to check the string for array of words and want to straight way console.log it.
The problem I'm having is that its not checking for "Exact words". For example if you put E, the text should show up since, there's no words that contains only 'E' however, its not showing up.
For instance:
const res = `EU, U.S. REACH DEAL TO RESOLVE BOEING-AIRBUS TRADE DISPUTE
$BA`;
const filters = ["E", "OPEC", "Repo"];
if (!filters.some(element => res.includes(element))) {
console.log(res);
}
Another method, I was thinking maybe using the split method and to check for every array item whether it's a filtered word or not.