+ 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 Answers
+ 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