Validate US Telephone Numbers: Fail Anyway?

Tell us what’s happening:
Hey friends! Run this code and look at the output in the console. Despite me console logging the exact same code snippet as the one I’m using for the return:


I get the correct booleen, as asked for in the instructions during the console log, but it doesn’t let it pass. The second and fourth conditions in the algorithm instructions both return true as requested. What am I doing wrong?! Please help me figure this out and get back in the groove of things. I feel like I’ve fallen a little behind lately.

Your code so far

function telephoneCheck(str) {
  var number = str.replace(/\-/g,"");
  console.log("________________" + number);
  var validate = new RegExp(/1?\(?\d+\)?\d+/, "g");
  return validate.test(number);


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36.

Link to the challenge:|

EDIT: found a solution. I’m still confused by this a little, but it seems I just need more practice with RegExp