Mini Linter project

Dear all,

I am currently on task no 3:

which identifies all the unnecessary words in the paragraph and removes it as a new array is generated.

I have included the answer below and also a second alternate which has failed. I would like some help to correct the syntax because I think I am missing something!

let betterWords = storyWords.filter(word => 

   ! unnecessaryWords.includes(word));

console.log(betterWords.length);
// returns 186 (correct answer)

// however the below returns error, unexpected token 

let betterWords2 = storyWords.filter (word => (storyWords == !unnecessaryWords) 

);

console.log(betterWords2.length);

Seeking your kind help,

Thank you and kind regards.

1 Like

I think I remember doing this one. For some reason removing the ‘!’ Seems to make it work. If I am remembering it correctly.