Learn Regular Expressions by Building a Spam Filter - Step 8

Tell us what’s happening:

where is the problem and what is ?

Your code so far

/* file: script.js */
const messageInput = document.getElementById("message-input");
const result = document.getElementById("result");
const checkMessageButton = document.getElementById("check-message-btn");

const helpRegex = /please help/i;


// User Editable Region

     isSpam() = msg.match(helpRegex);
     // i face problem at this line of code

// User Editable Region


checkMessageButton.addEventListener("click", () => {
  if (messageInput.value === "") {
    alert("Please enter a message.");
    return;
  }

  result.textContent = isSpam(messageInput.value)
    ? "Oh no! This looks like a spam message."
    : "This message does not seem to contain any spam.";
  messageInput.value = "";
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn Regular Expressions by Building a Spam Filter - Step 8

@Shabana_Asif Hello!
The fCC community is here to serve you, but we need your help so we can serve you better. What is your question, or what are you struggling with? What have you already tried, and what was the results? In the future please address the things mentioned above. You’ll get better results. It’s about good communication.

Are you trying to create a function?

-Happy coding!

Hi @Shabana_Asif

You almost got it.

Here is the original code:

const isSpam = (msg) => false;

Here is your code:

You correctly modified the right side of the assignment operator.
You modified the left side of the assignment operator, however you were not asked to do this.

Please reset the step to restore the original code and try again.

For next time, describe the issue in your own words. Learning to communicate problems is a part of becoming a web developer.

Happy coding

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.