I have a question about the filter() iterator.
I have MDN’ed it, Google’d it and looked at the Iterator lesson again, but I can only find examples for filtering words more than a certain length. The Codecademy Pro project says “There is an array of words that are unnecessary. Iterate over your array to filter out these words.” and suggests using .filter() to do it.
Is this correct?
let betterWords = storyWords.filter(word => word !== 'extremely', 'literally', 'actually');
It will filter out words that are not equal to those three words?. Well, I tried this and it does work but only for ‘extremely’ !
It also doesn’t work if I use an array of words that I wanted filtered:
let unnecessaryWords = ['extremely', 'literally', 'actually' ]; let betterWords = storyWords.filter(word => word !== unnecessaryWords);