Telephone Number Validator Is this is correct way?

Tell us what’s happening:
I think I just make or design my code just to reach the answer i.e to pass all the test. So, tell me is this is the right way of solving this or any problem?

Your code so far


function telephoneCheck(str) {
  // Good luck!
  let reg = /^[1\s]*[0-9()]{3,5}[-\s]*[0-9]{3}[-\s]*[0-9]{4}$/
  let counter = 0 //to count the opening and closing parenthesis are equal or not
  if(Number(str) && str.length != 10) {
    return false // to check the length of numbers equal to 10 if all the providing str is number i.e contain no parenthesis etc 
  }else if(reg.test(str)) {
		for(let value of str) {
			if(/[(]/g.test(value)) {
			   ++counter
		  } else if(/[)]/g.test(value)) {
			   --counter
		    }
		} // this conditional stmt to check the parenthesis
		if(counter ==0) return true
  }  
  return false
}
console.log(telephoneCheck("27576227382")) // false
console.log(telephoneCheck("(555)555-5555")) // true

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/telephone-number-validator