Clean up user-entered phone numbers so that they can be sent SMS messages.
The North American Numbering Plan (NANP) is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: 1 .
NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as area code , followed by a seven-digit local number. The first three digits of the local number represent the exchange code , followed by the unique four-digit number which is the subscriber number .
The format is usually represented as
(NXX)-NXX-XXXX
where N is any digit from 2 through 9 and X is any digit from 0 through 9.
Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
For example, the inputs
+1 (613)-995-0253
613-995-0253
1 613 995 0253
613.995.0253
should all produce the output
6139950253
Note: As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code.
Please I need help with the explanation of this question. I have tried it for four months up to no avail.
What is it that you don’t understand? The instructions and examples seem to be clear so you’ll need to expand on exactly what you need clear.
The takeaway from the instructions is that here
if N is 1 it is not a valid NANP phone number.
But from the text it doesn’t sound like any invalid phone numbers will be present. All your code needs to do is take out punctuation and the country code.
The example inputs show the punctuation that needs to be removed…the plus sign (+), the country code (1), hyphens (-), any white space and the period (.)
Firstly, welcome to the forums.
While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.
With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).
It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.
Please provide some example of what you’ve tried and I’m sure you’ll get more help.
Firstly, am at beginner level to javascript.
i replaced all of the other punctuation marks but couldn’t replace the 1 digit in the +1 country code without affecting the other numbers that have 1 inclusive in them