Telephone Number Validator - wrong expected boolean?

Tell us what’s happening:

I don’t understand why some of the tests should evaluate to false. Specifically:

telephoneCheck("1 555)555-5555") should return false.

telephoneCheck("555)-555-5555") should return false.

telephoneCheck("(555-555-5555") should return false.

And TBH, this one is also a bit spurious:

telephoneCheck("-1 (757) 622-7382") should return false

All of the above, I would consider to just be typos?

Your code so far

function telephoneCheck(str) {
  // Loop to strip input into a list of numbers

  var tempStr = "";
  for (var i = 0; i< str.length; i++) {
    var test = str[i];
    if (Number.isInteger(parseInt(test))) {
      tempStr += test;
  // console.log(tempStr);

  // Test length

    if(tempStr.length == 11) {
      // Test for country code of 1
      if (tempStr[0] == "1") {
        return true;
      } else {
        return false;
    } else if(tempStr.length == 10) {
      return true;
    } else {
      return false;



Your browser information:

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

Link to the challenge:
(Can’t link…not allowed to use links yet…)

I have no idea about American phone numbers, but you have been given a task, which is to evaluate if the number is valid following certain criteria, you can’t change the criteria.
Maybe there is an other program that uses the phone numbers expecting only specific patterns and if it is given numbers wittten in the wrong way it stop working. Whatever.
Your task is to evaluate the numbers using those criteria.