mardi 11 décembre 2018

Why does my test pass, even though it doesn't meet my logic gate?

I'm working on telephone validator on FCC. For some reason this passes 5555555555. Why does my logic gate pass this number? For context, this isn't my first attempt at this code. I've added multiple statements, nested if statements, and it still doesn't catch it.

function telephoneCheck(str) {
  if(str[0] === '1' || '(' && str.length >= 10) {
  return true;

  }
  else {
    return false;
  }
}

telephoneCheck("5555555555");

Aucun commentaire:

Enregistrer un commentaire