How i can do it?

Hello, i can’t find any solution… My reflection:

  • remove ‘-’ and find if it’s number and length === 10.

for other, make a pattern and check if they match with it.

I’m block and i need little help to grow my reflection…

  **Your code so far**

function telephoneCheck(str) {
str = str.replace(/[^\d]/g, "");

if(str.length === 10){
  return true
}

}

telephoneCheck("555-555-5555");
  **Your browser information:**

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

Challenge: Telephone Number Validator

Link to the challenge:

You’re probably going to want to write regular expressions to match the patterns.

1 Like

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