about | help | code help+videos | done | prefs |
makePhoneNumber
Given an input string representing 10-digits phone number, determine if the number is valid, and return the number formatted. A number is valid if neither the area-code nor the actual number starts with zero. If the number is invalid, return an empty string. The formatting should be in the form (xxx)xxx-xxx , where x represents the digits. makePhoneNumber("6502345678") → "(650)234-5678" makePhoneNumber("0502345678") → "" makePhoneNumber("1500345678") → "" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy