mercredi 21 octobre 2020

Return statement not working in If statement ? (to compare lengths of two strings)

However, the function works just fine if I use alert();

function checkLength(str1,str2){
  if (str1.length !== str2.length) {
  return false
  }
  return true
}

checkLength("abc","abcd");

Aucun commentaire:

Enregistrer un commentaire