Skip to content

Instantly share code, notes, and snippets.

@Amanhas2492
Created June 16, 2018 07:42
Show Gist options
  • Save Amanhas2492/84f839a009b2d1c6cf198e7c798fb50c to your computer and use it in GitHub Desktop.
Save Amanhas2492/84f839a009b2d1c6cf198e7c798fb50c to your computer and use it in GitHub Desktop.
JavaScript Algorithms and Data Structures Projects: Telephone Number Validator FCC
function telephoneCheck(str) {
var s = /^[1]?\s?(\(\d{3}\)|\d{3})[-.]?\s?\d{3}[-']?\s?\d{4}$/;
var a = s.test(str);
return a;
}
telephoneCheck(555-555-5555);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment