If the expressionA is true, executes statementA. If the expression is false, evaluates expressionB. If expressionB is true, executes statementB. Otherwise, executes statementC.
Syntax
if (expressionA)
statementA
[else if (expressionB)
statementB]
[else
statementC]
Example
if (myCat=="Jasmine")
alert (myCat);
else if (myCat==" ")
alert("No cat!");
else
alert("Wrong cat!");
Remarks
You can nest as many "else if" statements within the block as you need; however, if you use multiple "else if" statements, you might want to consider using a "switch" statement for cleaner code.