Grammar Checker project

Hello!
I’m working on the Grammar Checker and am stuck on step 6 where I’m asked to filter out the unnecessary work ‘Literally’. I followed the walkthrough video but my code isn’t working. In the video the developer coded the following:
storyWords = storyWords.filter((word) => {
return word !== unnecessaryWord;
})
I’ve checked over my code a few times but still don’t see what is different between my code and the walkthrough code. I’ve included my link at the bottom. If anyone would be willing to check it out I’d appreciate it.
Samantha

https://www.codecademy.com/workspaces/62728c3f5d5589696db5b8f4

Well I’m not sure what I did differently but after deleting my code and rewriting it the code is now working :slight_smile:

(post deleted by author)

This is what I got, and it went just fine. You forgot to add the if statement and the variable word does not need ( ) around itself.

storyWords = storyWords.filter(word => {
  if(word != unnecessaryWord) {
    return word;
  }
});
1 Like

Hello, can anyone explain why in step 11 or Grammar Checker project we use “&&” before console.log?
so the code looks like this:
word.length > 10 && console.log(word)

I dont understand why there’s “&&”?

Hi Java!

I’m not 100% sure this is correct but I believe the developer in the video said he used the && (which is a true && true logical operator) along with the console.log to show the one word that was greater that 10 letters. I hope this helps :blush:

oh well now it starts to make sense to me. Thank you very much!

1 Like