**Why my code can’t get false in this test case:
telephoneCheck("(6054756961)");
**
**Your code so far**
function telephoneCheck(str) {
let checkNum = str.replace(/[^\d]/g, "");
let hasPermittedCharsOnly = str.match(/[\s|\-]/g);
let twoOr0 = str.match(/[/(/)]/g);
if(checkNum.length === 10 || (checkNum.length === 11 && str.charAt(0) == 1)){
if( hasPermittedCharsOnly === null){
return true;
}else if(hasPermittedCharsOnly.length + checkNum.length == str.length){
return true;
}else if(twoOr0.length === 2 && (/\d$/).test(str) && (str.charAt(0) === "(" && str.charAt(4) === ")") || ((str.charAt(1) === "(" && str.charAt(5) === ")")) || (str.charAt(2) === "(" && str.charAt(6) === ")")){
return true;
}else{
return false;
}
}else{
return false;
}
}
telephoneCheck("(6054756961)");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
.
Challenge: Telephone Number Validator
Link to the challenge: