Learn Regular Expressions by Building a Spam Filter - Step 12

This code runs and i don’t understand why

const isSpam = (msg) => denyList.some((regex) => regex.test(msg)) || helpRegex.test(msg);

2 Likes

Why is the || there?

2 Likes

I just tried it and it worked so i’m confused as well

2 Likes

Hmm, try not using the || and everything after

3 Likes

yeah that’s the correct answer Thank you

2 Likes

This is such a great explanation. It helped me solve and understand this one. I literally created a new account to like and post this. Thank you lasjorg!

2 Likes

Thank you, this is very helpful!

1 Like

It would be nicer if the instruction could just tell us to amend the existing code

5 Likes

Thank you! This explanation also helped me as well.

This is one of the issues I’m facing with this JavaScript course. I find that certain steps are way to vague or too jargon heavy without a easier explanation.

I don’t need to to be shown baby steps, but I also need a little more more to go off of sometimes or maybe the hint system could provide a stronger explanation. JavaScript is still very new to me and I often feel lost with some of these steps.

5 Likes

The new curriculum is still being worked on. It will slowly improve over time, I’m sure.

I do agree this step could be clarified a bit better. Anyone can open an issue for it if they would like to.

1 Like

Guys this just an appreciation for solving the problem, and I realised it started from January and finally solved on May well done guys that is the spirit of a developer.

2 Likes

Thanks for this reply, sometimes the text of the steps is not very descriptive.

2 Likes

Yeah, very true. This lesson especially. I think it should be broken up into 2 steps, and the instructions made more clear. Instructions should at least say that you are modifying the existing arrow function.

Also, the example used is very poor and confusing:
arr.some(letter => letter === letter.toUpperCase())
What even is that inside the .some method? It kind of looks like an implicit arrow function but it’s missing the paramater. Even functions that don’t declare a parameter need the brackets (), right? Anyways, your function needs them, so the example should mimic the solution.

1 Like

If there is only one parameter, you do not need ()

Ok, that’s the first time I have heard that. We haven’t been taught that before (from what I remember), so this is a poor example that just causes confusion.

1 Like