Day 4 Challenge

Happy day 4 of 365 days of coding! Write a function that accepts a string of numbers or a number and converts it to a phone number format.

Examples:

      phoneFormat(2359654144) //'235-965-4144'
      phoneFormat('2359654144') //'235-965-4144'
      phoneFormat(1234) //error: was not supplied enough numbers please pass a 10 digit number
      phoneFormat(23596541445) //error: was supplied too many numbers please pass a 10 digit number
Previous
Previous

Phone Number Formatter JavaScript

Next
Next

ROT13 Cipher JavaScript Solution