Javascript Reference
Categories: Operators

javascript Operators if/else

@March 15, 2008, 1:22 a.m.
if/else Firefox/Netscape/NN 2 IE 3 ECMA 1  

  

This is a conditional statement that provides two execution paths depending on the result of the condition. You can nest another if or if/else statement inside either path of the if/else statement.

 
Example
 
var theMonth = myDateObj.getMonth( );
if (theMonth == 1) {
    monLength = calcLeapMonthLength( );
} else {
    monLength = calcMonthLength(theMonth);
}

Powered by Linode.