mercredi 29 août 2018

Use conditions in javascript [duplicate]

Can i use multiple if and then after an else like this ?

if(sky == 'blue') { ... }
if(sky == 'red')  { ... }
else { alert('Sky is not blue or red'); }

When do I need else if ?

Thanks.

Aucun commentaire:

Enregistrer un commentaire