Mini Linter Step 3

Is there an easier way to check if an unnecessaryWord exists in story? I have spent hours trying to figure out if this solution could be improved logically or even being simpler.


storyWords.forEach(word=>{
  if(!unnecessaryWords.includes(word)){
    betterWords.push(word)  
  }
})

Have you tried to do this without using iterators (.forEach(), .includes())?

1 Like

No, but I’ll give it a go.

2 Likes

Hi @tag9677509016 . Thanks for sharing your query with the forum.
Actually your code is the best version I thing. I have tried myself to write it without iterators, when I was doing this particular exercise, but believe me, it was far more difficult to understand and less readable as compare to the code written using iterators.

1 Like