I have created this Regex function and it returns false because of the second condition, but I cannot undestand why?
function telephoneCheck(str) {
if (str.match(/[!?]/) !== null) {
return false;
} else if (str.match(/\d/g).length === 11 && str[0] !== 1) {
return false;
}
};
console.log(telephoneCheck("1 555-555-5555"));
(after function.function(telephoneCheck(str)Please make sure to post compilable code.