Telephone Number Validator

  Last updated September 2023

  freeCodeCamp Certification Project

Logo for the JavaScript programming language

Developer Credits

  •   Developed by Daniel Fletcher

Project Link

View project on CodePen

Link will open in a new tab.

Skills & Technologies

  • JavaScript

Project Details

JavaScript implementation of an algorithm that validates US telephone numbers.

Regular expressions are awesome.

They were certainly useful for this project, anyway. Using regular expressions in conjunction with the  str  member function  search ,  I managed to design a solution to the telephone number problem in just a handful of lines!

The CodePen link above will open an in-browser code editor and console. Tinkering at the console will enable you to interface with the  telephoneCheck  function I implemented. Below are some of my personal friends' and family members' phone numbers to try for testing:

Relevant links:

Related Projects

This is certification project 4 of 5 in the JavaScript Algorithms and Data Structures track at freeCodeCamp. Each of my project submissions in this track is linked below.

Palindrome Checker

Sep 2023

JavaScript implementation of a simple palindrome validator function.

     

Roman Numeral Converter

Sep 2023

JavaScript implementation of a function that converts a base-10 integer to its Roman numeral counterpart.

     

Caesars Cipher

Sep 2023

JavaScript implementation of the Caesar cipher substitution algorithm. Uses the common ROT13 variant.

     

Telephone Number Validator

Sep 2023

JavaScript implementation of an algorithm that validates US telephone numbers.

     

Cash Register

Sep 2023

JavaScript implementation of an algorithm that simulates making change at a cash register, making exact change when possible.