Tell us what’s happening:
I’m almost done with this exercise but I’m not able to figure out how to check for a balanced parenthesis.
Your code so far
function telephoneCheck(str) {
var s = /^[1]?\s?\(?\d{3}[-.]?\)?\s?\d{3}[-']?\s?\d{4}$/;
var a = s.test(str);
return a;
}
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/67.0.3396.87 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/