Availability: |
| |||||||
JavaScript syntax: | - | if(aCondition){someCode1} else{someCode2} | ||||||
Argument list: | aCondition | A condition that tests true or false | ||||||
someCode1 | Code to be executed if the condition tests true | |||||||
someCode2 | Code to be executed if the condition tests false |
This is an optional additional statement that can be added to an if() condition test to allow for some alternative code to be executed when the condition tests false. The true case will cause the first block of code to be executed, the false case will execute the second (that which follows the else keyword).
ECMA 262 edition 2 - section - 12.5
ECMA 262 edition 3 - section - 12.5
Wrox Instant JavaScript - page - 23
Prev | Home | Next |
Element.uniqueID | Up | else if( ... ) ... |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |