Arrow notation issues

no matter what combination of ), }, and => I try I can NOT figure out why this won’t work, and this is precisely why I hate that arrow syntax is even a thing, it makes so confusing when I just want to write a function. What am I missing here? How do I make this work??? I am losing my mind. It SHOULD work, I have all the right requisite parts, I just need the proper formatting. The error is specifically telling me that “word” is the issue and no matter how I wrap it or if I add => it just will not work.

let betterWords = story.filter(word){

Hello, @cvphelan. Looks like you’re just trying to use the array.filter() method. You don’t have to use the arrow function syntax, but you can. There are several options for doing what you are attempting, but since you asked about arrow functions, we’ll go with that. First, .filter() is a method that takes a function as an argument. The elements of the array that .filter() is called on, that evaluate to true when passed to the function will be returned. So the first step is to simply write a call to the the .filter() method:

let betterWords = storyWords.filter(); //this won't work yet, but note that we need opening and closing parenthesis

Now we need to add in the function. You are attempting to use an anonymous (nameless) arrow function. You can either use a concise body arrow function (no curly braces and no return keyword) or a regular arrow function:

//arrow function
let betterWords = storyWords.filter(word => {
  return !unnecessaryWords.includes(word)

//concise body arrow function
let betterWords = storyWords.filter(word => !unnecessaryWords.includes(word));

Notice in both cases, the function is between the original parenthesis. You don’t necessarily have to use an arrow function. You could write the function using a function declaration, and pass it in, or use an anonymous function:

//separate function
function filterOutWords(word) {
  return !unnecessaryWords.includes(word); //returns either true or false
//pass the function above as the argument to the .filter() method
let betterWords = storyWords.filter(filterOutWords); //here we simply pass the function, and filter passes each element of the storyWords array as the argument to our callback function
//or anonymous function
let betterWords = storyWords.filter(function(word) {return !unnecessaryWords.includes(word)});
//.filter's opening parenthesis    ^                         ...and the closing parenthesis ^

There remain additional ways to accomplish the above. We could have written the named function that we passed in as either an arrow function or concise body arrow function, but hopefully this has helped.