The intent of the challenge is to create one regex that tests all the phone numbers that the test tests for. It can be done with one regex. Look into that rather than the if else statement. I’m not saying it can’t be done with your approach but it is shorter and easier to read with one regex.
eoja
2
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Validate US Telephone Numbers1 | 6 | 714 | February 2, 2021 | |
| Telephone Number Validator problem | 8 | 724 | January 25, 2021 | |
| Telephone Number Validator...........FCC solution is incomplete | 4 | 732 | February 2, 2021 | |
| JavaScript Algorithms and Data Structures Projects Telephone Number Validator | 7 | 566 | January 8, 2022 | |
| Phone Number Validator Help | 2 | 420 | March 28, 2023 |