Validate US Telephone Numbers1

Validate US Telephone Numbers1
0.0 0

#1

Hey,I don;t know how to do it do you help me??

Your code so far

function telephoneCheck(str) {
  // Good luck!
  return true = ;
}



telephoneCheck("555-555-5555");

Your browser information:

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

Link to the challenge:


#2

What have you tried?


#3

i tried all what it want


#4

You haven’t shared any code or description of approaches you have tried and how they failed. We can’t help if we don’t know where you’re at.


#5

function telephoneCheck(str) {
// Good luck!
return true;
}

telephoneCheck(“555-555-5555”);
telephoneCheck(“123**&!!asdf#”);
telephoneCheck(“55555555”);
telephoneCheck("(6505552368)");

I have tried that


#6

function telephoneCheck(str) {
var regex = /^(2\s?)?((\d{3})|\d{3})[\s-]?\d{3}[\s-]?\d{4}$/;
return regex.test(str);
}
telephoneCheck(“555-555-5555”);
and that