Mini linter

I’ve done this project (Introduction to JS - iterators - mini linter), but I have a big question:

when we use method .split(’ ') to do an array storyWords, some elements of new array contains symbols (, - ! etc), for example the element storyWords[1] (‘weekend,’)
The next step is to find particular words in this array. If I look for a word ‘weekend’, the result won’t include storyWords[1] because of ‘,’

So, how can I modify my code to be sure that punctuation marks don’t affect the result?
I’ll be glad to get help with this case

Here is my code:

Hello @maria1819, this probably isn’t what the course wants you to do, but you could use a regular expression. I’m no’t sure exactly how to do use them in JS, but the expression itself could be like this:


This article explains how to do regex in JS nicely.
I hope this helps!

Thank you, I’ll try it

1 Like