Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 83 - 2625 PortGPt V2.1
P. 83

    </SCRIPT>

                     </BODY>
                     </HTML>
                     On running the above program, we get the following output:

                          The if…else Statement

                     The if…else statement checks for a condition. If the condition evaluates to True, the indented block
                     following the if statement is executed, otherwise the indented block after the else statement is
                     executed. The syntax of the if… else statement is given below:
                     Syntax:

                     if (condition)

                     {
                          // When the condition is true then block of code to be executed.
                     }
                     else

                     {
                          // When ’if’ statement condition is false then block of code to be
                         executed.
                     }

                                                                                     Conditional Statements in JavaScript  81

| 78 79 80 81 82 83 84 85 86 87 88 |