Mini Linter Step 3 .filter() and .includes()


#1

Sorry this is going to be broad, and probably not well thought out. Lack of sleep and kids will do that to you. Here is my code.

//Step 3. Filter out the words in the ‘unnecessaryWords’ array.

let betterWords = storyWords.filter(goodWords => !unnecessaryWords.includes(goodWords));

console.log(betterWords);

I got pretty close to the code above by using the .filter() method but got lost on how to have the log spit out the ‘betterWords’ variable sans all the variables in ‘unnecessaryWords’ array.

To be clear the code I pasted works. But I am not sure how. I found the answer in these forums. Specifically how does the (!) mark come into play with this code? I couldn’t find the documentation that clearly explains this under MDN nor in any of Codecademy’s forums.

Could someone give me an ELI5 type explanation? Sorry for noobing on yall! :sweat: