+ 5
What is the difference between IF,ELSE and ELSE IF in java script?
Can anyone explain it?
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
}
+ 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.
+ 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
+ 1
example:
if(5>6){
alert(5)
} else if (5<6){
alert(6)
} else {
alert("nothing ")
}
+ 1
Thanks for answering
0
u r wlc bro
Just keep learning đ