This question already has an answer here:
This expression
if("0"){ alert("true");}else{alert("false");}
results "true".
Why is that, when
if("0" == true){alert("true");}else{alert("false");}
results "false"?
I'm used to
"0" == 0 == false
Seems like that does not hold true only in an if-statement.
Is this the intendet behavoir? Can some one shed some light on it?
Aucun commentaire:
Enregistrer un commentaire