UMM whats going on here

const number = document.getElementById(“user-input”)
const results = document.getElementById(“results-div”);
const clear = document.getElementById(“clear-btn”);
const phoneNumber = new Set([“1 555-555-5555”,
“1 (555) 555-5555”,
“5555555555”,
“555-555-5555”,
“(555)555-5555”,
“1(555)555-5555”,
“1 555 555 5555”,
“1 456 789 4444”])

    const validateNumber = () => {
          let numberInput= number.value
               if(!numberInput){
                 alert("Please provide a phone number");
                        return;}
          else if(phoneNumber.has(numberInput)){
     results.textContent = `Valid US number: ${numberInput}`}
          else {
     results.textContent = `Invalid US number: ${numberInput}`

}
}

What is surprising to you? Are you trying to hardcode correct answers?

is not running and shows dots when i type the text content

what is not running, what is your complete code, what is the link to the project?
what do you mean “shows dots”, where are you typing text content?

Normalize input for better phone number validation in JavaScript.

hey there, do you have a question?

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