Tell us what’s happening:
When I look in hints section and try the Intermediate solution for this challenge given in it, it wouldn’t pass the test.
Your code so far
function telephoneCheck(str) {
var re = /^((\+?1\s*([.-]\s*)?)?(\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*([.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*([.-]\s*)?([0-9]{4})$/;
return re.test(str);
}
telephoneCheck("555-555-5555");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator