Skip to content

Instantly share code, notes, and snippets.

@sakilk130
Last active May 30, 2021 14:29
Show Gist options
  • Save sakilk130/c39ac0373ebfe512c8bbfd0cece41f73 to your computer and use it in GitHub Desktop.
Save sakilk130/c39ac0373ebfe512c8bbfd0cece41f73 to your computer and use it in GitHub Desktop.
FreeCodeCamp JavaScript Project
var re =
/^([+]?1[\s]?)?((?:[(](?:[2-9]1[02-9]|[2-9][02-8][0-9])[)][\s]?)|(?:(?:[2-9]1[02-9]|[2-9][02-8][0-9])[\s.-]?)){1}([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2}[\s.-]?){1}([0-9]{4}){1}$/;
function telephoneCheck(str) {
return re.test(str);
}
telephoneCheck('555-555-5555');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment