Learn Regular Expressions by Building a Spam Filter Step 12

I dont understand why are we using “regex” as call back function with arrow syntax using “.text()” method that rerurns boolean as false for clarity. What am I doing wrong in here?

You used msg which is not declared as a variable. It’s a parameter of your function isSpam.
The challenge was to update isSpam function’s body to be what you did instead.

I didn’t understand what you are asking about

1 Like

I was so confused, Thank you very much Mostafa. Like always you save me from this confussion

1 Like

first, use the some() to check if the regex exists then compare with msg with test() on rejex
solution code removed

This was already resolved 2 months ago.

Please do not share solution code.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.