Mini Linter: Step 3 syntax error?


For the solution for step 3, I made this:

let betterWords = storyWords.filter(word => !overusedWords.includes(word));

All the syntax looks correct, right? Well I keep getting this error:

let betterWords = storyWords.filter(word => !overusedWords.includes(word));

TypeError: storyWords.filter is not a function
  at Object.<anonymous> (/home/ccuser/workspace/learn-javascript-iterators-P1/main.js:12:30)
  at Module._compile (module.js:571:32)
  at Object.Module._extensions..js (module.js:580:10)
  at Module.load (module.js:488:32)
  at tryModuleLoad (module.js:447:12)
  at Function.Module._load (module.js:439:3)
  at Module.runMain (module.js:605:10)
  at run (bootstrap_node.js:427:7)
  at startup (bootstrap_node.js:151:9)
  at bootstrap_node.js:542:3

No idea where I went wrong, and I also went to other questions that had similar problems(Yes I copied and pasted. ONLY FOR THIS I SWEAR :sweat_smile:) I’m guessing its some kind of very simple syntax that I overlooked, so please help!!!


That is not a syntax error, read what it says and look at what you do with it
And also keep in mind that error messages can’t tell you what you did wrong or what it should be, so don’t ever take them as advice on what to do differently, instead consider what should have happened there and make it so


Um i have a feeling that this a major brain fart, but .filter() returns a new array right? There is nothing wrong with the syntax(ding, ding, ding!), and no matter how I type .filter(), I keep getting an error. I transferred the function inside .filter() and put in the condensed version and keep getting the error…

Here is all my code if that helps.

let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It\'s really an adventure from beginning to end! It is a 48 mile loop and it basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left to go. After a quick photo op at the very popular Little Red Lighthouse, I began my trek across the George Washington Bridge into New Jersey.  The GW is actually very long - 4,760 feet! I was already very tired by the time I got to the other side.  An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson.  Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.';

let overusedWords = ['really', 'very', 'basically'];

let unnecessaryWords = ['extremely', 'literally', 'actually' ];

story.split(' ')
storyWords = story

let funct = (word) => !overusedWords.includes(unnecessaryWords)

let betterWords = story.filter(funct)


Sorry i keep prying, but this is literally driving me nuts ;-; This seems so simple too…


.filter() is not by itself a thing
Arrays have an attribute named filter which refers to a function, so if you do:


Then yes, that evaluates to a function. Your error message says that you’re calling something that is not a function, so you can then conclude that whatever you’re requesting its filter attribute from isn’t an array at all.

When something “doesn’t work”, check the things that are supposed to make it work (you’re the one responsible for lining those up)


Lol I see. Thanks a ton!