Telephone Number Validator 1

Tell us what’s happening:
Having some problems returning my code false in my test cases

  **Your code so far**

function telephoneCheck(str) {
var patt = new RegExp(/^\+?1?\s*?\(?\d{3}(?:\)|[-|\s])?\s*?\d{3}[-|\s]?\d{4}$/);
return patt.test(str);

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

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

Challenge: Telephone Number Validator

Link to the challenge:

Which test cases? Have you been able to narrow down what part of your regular expression isn’t working? What changes have you already tried to solve the problem?

Well test cases 10 and 21 which states about the return false problem and i try using different solutions to problem but struggling to comprehend what is problem.

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