Tell us what’s happening:
i’m wondering why \d is not validating 1 456 789 4444. if \d{4} is limiting whole number to be 4 digit only.
how can i make it so it only also accept whole number.
Your code so far
function telephoneCheck(str) {
// Good luck!
let regexp = /^1?(\W*\d{3}\W*)\1\d{4}$/
return regexp.test(str);
}
telephoneCheck("555-555-5555");