DEV Community

Cover image for Day 4 Challenge

Day 4 Challenge

hellodevworldblog profile image Hello Dev World Blog Originally published at ・1 min read

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.


      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
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Editor guide