Cant seem to remember which regex will make the failed challenge a false boolean? Please help
Tell us what’s happening:
Describe your issue in detail here.
Your code so far
function telephoneCheck(str) {
const validated = [
/*555-555-5555*/
/^\d{3}-\d{3}-\d{4}$/,
/*(555)555-5555*/
/^\(\d{3}\)-\d{3}-\d{4}/,
/*(555) 555-5555*/
/^\(\d{3}\)\s\d{3}-\d{4}/,
/*555 555 5555*/
/^\d{3}\s\d{3}\s\d{4}/,
/*5555555555, done*/
/^\d{10}/,
/*1 555 555 5555*/
/^1\s\d{3}\s\d{3}\s\d{4}/,
/*1 555-555-5555*/
/^1 \d{3}-\d{3}-\d{4}/,
/*1 (555) 555-5555*/
/^1\s\(\d{3}\)\s\d{3}-\d{4}/,
/*(555)555-5555*/
/^\(\d{3}\)\d{3}-\d{3}/,
/*1(555)555-5555*/
/^1\(\d{3}\)\d{3}-\d{4}/,
/*27576227382*/
/\\d{11}/
]
return validated.some((pattern) => pattern.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/106.0.0.0 Safari/537.36
Challenge: JavaScript Algorithms and Data Structures Projects - Telephone Number Validator
Link to the challenge: