Tell us what’s happening:
Describe your issue in detail here.
Hi Everyone,
I came up with this regex to solve this challenge and was kind of proud of myself with it
However the test won’t pass, i realy don’t get why, as you can see in my code, i log what the function return before returning it and to me, it seems that true is returned when needed and false also.
It seems all truthy tests are not passing…
Thx for your help regarding this, i’m on this regex since 2 days and i might be to close to the subject to see something realy evident for someone with more distance on the code.
Sorry for my english, foregner…
**Your code so far**
function telephoneCheck(str) {
let killerRegex = /^1?(([\s\-]?\d{3}[\s\-]?)|(\s?\(\d{3}\)\s?))\d{3}[\s\-]?\d{4}/gm
console.log('----------------------------------------')
console.log(str)
console.log(killerRegex.test(str))
console.log('----------------------------------------')
return killerRegex.test(str);
}
telephoneCheck("1 555-555-5555");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Challenge: Telephone Number Validator
Link to the challenge: