What is the difference between IF,ELSE and ELSE IF in java script? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

What is the difference between IF,ELSE and ELSE IF in java script?

Can anyone explain it?

9th May 2019, 9:05 AM
potato
potato - avatar
6 Respostas
+ 2
if( if any thing here true ){ do the thing here. } else if ( else if other thing true ){ Do the function here } else { Do if every booleans above false }
9th May 2019, 9:17 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 4
IF ELSE IF (Ɨany number of times) ELSE Basically you're trying to get various statements to be tested in a specific order. ELSE is like a last resort when all statements fail to return True.
9th May 2019, 9:21 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar
+ 4
imagine there is a basket with two color balls(red and green) and you picked one if(col==ā€œredā€){alert(ā€œredā€)} else if(col==ā€œgreenā€){ alert ā€œgreenā€} else { alert(ā€œcolor is neither green nor redā€} //if neither first or second are true
10th May 2019, 6:42 AM
Logomonic Learning
Logomonic Learning - avatar
+ 1
example: if(5>6){ alert(5) } else if (5<6){ alert(6) } else { alert("nothing ") }
9th May 2019, 9:19 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
Thanks for answering
9th May 2019, 9:20 AM
potato
potato - avatar
0
u r wlc bro Just keep learning šŸ˜‰
9th May 2019, 9:21 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar