Validate US Telephone Numbers- checking opening and closing braces in area code

Tell us what’s happening:
telephoneCheck(“1 555)555-5555”)
How to check if open ‘(’ bracket exists we need to have ‘)’ too?

Your code so far

function telephoneCheck(str) {
  var rex=/^1{0,1}\s?\(?\d{3}\)?(-|\s)?\d{3}(-|\s)?\d{4}/g;
  // Good luck!
    return true;
  return false;


Your browser information:

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

Link to the challenge:

you can use regex to count frequency of ( and )
if frequency of ( and ) isn’t equal, it must be false

Hi! How can I count the frequency with regex?