JavaScript Algorithms and Data Structures Projects - Telephone Number Validator

Tell us what’s happening:
I am failing on 3 tests, I have tried using Lookahead assertions and failed, could anyone assist me? ty.

Your code so far

function telephoneCheck(str) {
  let validNumber = /^1?\s?\(?\d{3}\)?\s?-?\d{3}\s?-?\d{4}$/gm
  return validNumber.test(str);
}

telephoneCheck("5555555555");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

Challenge: JavaScript Algorithms and Data Structures Projects - Telephone Number Validator

Link to the challenge:

So what do the three tests you aren’t passing all have in common?

They all have parenthesis ? ;p

edit: i’ve done this /^1?\s?\(\d{3}\)\s?|^1?\s?\d{3}\s?-?\d{3}\s?-?\d{4}$/gm
I’ve placed an OR option but then I am not sure why I am getting the two fails that I’m getting…

You’re on the right track. In fact, you’re very close. You’re using the pipe which is sort of acting as “match either this OR that”. What exactly the two sides of that OR? You might want to make it clearer.

Okay , I’ve completed it thanks a lot. Now I understand how “OR” works.