Tell us what’s happening:
Describe your issue in detail here.
i’ve got problems with the digit 1 and the “()”
Your code so far
function telephoneCheck(str) {
let regex = /^1?\s?(\d{3}|\(d{3}\))-?\s?\d{3}-?\s?\d{4}$/gm
return regex.test(str)
}
console.log(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/105.0.0.0 Safari/537.36 OPR/91.0.4516.95
Challenge: JavaScript Algorithms and Data Structures Projects - Telephone Number Validator
Link to the challenge: