JavaScript Algorithms and Data Structures Projects - Telephone Number Validator

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

I having a hard time figuring this out

function telephoneCheck(str) {
const regex = /'^'(1\s?)?(\()?\d{3}(?(2)\))[-.\s]?\d{3}[-.\s]?\d{4}$/;
return regex.test(str);
};

console.log(telephoneCheck("555-555-5555"));

Your browser information:

User Agent is: Mozilla/5.0 (Android 9; Mobile; rv:109.0) Gecko/119.0 Firefox/119.0

Challenge Information:

JavaScript Algorithms and Data Structures Projects - Telephone Number Validator

  • what are these supposed to validate, are you using any validator console before hand coming up with that checker string?!
  • look into regexOne, they have a very thorough coverage about using regex

happy coding :slight_smile:

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