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

Ð Output:
                 Ð a = 8 + 9 + 9 % 7
                 Ð a = 17 + 2
                 Ð a = 19


                 Ð ÐIf var a = 7, then what is the value of a after evaluating the expression given below:
                 Ð a+=a++ + ++a - --a + a--
                 Ð Output:

                 Ð a += a++ + ++a - --a + a--
                 Ð a = 7 + (a++ + ++a - --a + a--)
                 Ð a = 7 + (7 + 9 - 8 + 8)
                 Ð a = 23
                  ÐIf var a = 10, b = 5, then what is the final value of a after solving the following expression in JavaScript:
                 Ð
                 Ð a -= a * b + a - b + a/b - 2
                 Ð Output:
                 Ð a = a - (a * b + a - b + a/b - 2)
                 Ð a = 10 - (10 * 5 + 10 - 5 + 10/5 - 2)

                 Ð a = 10 - (50 + 5 + 2 - 2)
                 Ð a = 10 - 55
                 Ð a = -45


                                                 Lab Assignment ‘n Activity                           Interdisciplinary




                   1.  Calculate the following expressions:
                         (12*11) + 25 – 10
                         22/2*5 + 4 – (12+6) – 6
                         34 +7 – 15/3 * 7 + 4
                   2.  Check the output of the following code. Explain the output.
                       <html>
                       <body>
                       <script>
                       a=45
                       b=4
                       document.write(++a)
                       document.write(b++)
                       </script>
                       </body>
                       </html>



                 Functions Used in JavaScript
                 A function is a reusable code-block that will be executed whenever it is called. The function is a great time saver. It
                 is used for performing repetitive tasks where you can call the same function multiple times to get the same effect. It
                 allows code reusability.

                                                                      Introduction to Dynamic Websites Using JavaScript  301
   298   299   300   301   302   303   304   305   306   307   308