August 1999
Intermediate to advanced
1488 pages
72h 53m
English
if(statement){ code; }else(statement){ code; }
The if…else statement is used to perform logic statements on specific cases. If statement is satisfied, its statements are executed. Otherwise, the else statement is evaluated. When statement evaluates to true, code is executed.
In Listing 6.144, you see how the if…else statement is being used to determine if the temp Boolean value is true.
<html> <body> <script lanuguage="JavaScript"> <!–– Hide var temp = 1; if(temp == true){ document.write("Statement is true"); } else{ document.write("Statement is false"); } // End Hide –– > ... |
Read now
Unlock full access