dimanche 29 décembre 2019

I'm having confusion about if-statement in javascript

I have a condition in javascript like this :

var a = '60';
var b = '500';

if(a < b) {
  console.log('true');
} else {
  console.log('false');
}

but the result is false, my expectation should be true, but i tried to compare with php code :

<?php 

  $a = '60';
  $b = '501';

  if($a < $b) {
    echo 'true';
  } else {
    echo 'false';
  }

?>

and the result is true, if in javascript there is no else if condition it will automatically read to the false condition if the value is not true?

Aucun commentaire:

Enregistrer un commentaire