Page 82 - PortGPT_V2.1_C8_Flipbook
P. 82

On running the above program, we get the following output:





















































                   Program 2: To demonstrate the if statement.

                  <!DOCTYPE HTML>

                  <HTML>
                  <HEAD>
                      <TITLE> if statement </TITLE>
                  </HEAD>
                  <BODY>

                  <SCRIPT>
                    var days = parseInt(prompt("How many days are there in a leap year?"));
                    if(days == 366)

                    {
                      document.write("Your answer is correct, Good Job.");
                    }



                  80    Premium Edition-VIII
   77   78   79   80   81   82   83   84   85   86   87