samedi 24 novembre 2018

What is the simplest syntax of the if-else statement in JavaScript?

if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2)   return false ;
endgame();   return true;

this is the some JavaScript code which I'm not really understand, the code are using the simplest way to write the if-else statement but it makes me confuse about it, because how could it having three else with a same condition? the way that I interpret is

if(b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {return false} else {endgame()} else {return true}

but I feel weird with this so I asked this question, I just want to know the correct syntax of this code. I think it may be my misunderstood of the code.

Aucun commentaire:

Enregistrer un commentaire