Page 330 - Web Applications (803) Class 11
P. 330

</SCRIPT>
                 </P>
                 </BODY>
                 </HTML>
              Output:

















              When you click on the “OK” button, with the message “This page says”. Then a new windows appears as shown below:



















                                               Lab Assignment ‘n Activity                          Interdisciplinary



                 Write JavaScript code for the following:
                 1.  Display all odd numbers from 39 till 11.
                 2.  Accept 5 numbers from the user and find their average.
                 3.  Accept two numbers from the user. Calculate first number raised to the power of second number.
                 4.  To get the first n Fibonacci numbers.
                     (  Note: the Fibonacci sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, . . each subsequent
                     number is the sum of the previous two numbers.)                                 [CBSE Handbook]


              The for….in Loop

              The for...in  statement iterates across an object’s properties. For each property, the code block inside the loop  is
              executed once. Syntax of the for loop is as follows:
                  for (i in object) {
                    block of code to be executed
                 }







                328     Touchpad Web Applications-XI
   325   326   327   328   329   330   331   332   333   334   335