Page 156 - DCAP408_WEB_PROGRAMMING
P. 156

Web Programming




                    Notes          The number is 2
                                   The number is 4
                                   The number is 5
                                   The number is 6

                                   The number is 7
                                   The number is 8
                                   The number is 9
                                   The number is 10

                                   Explanation: The loop will break the current loop and continue with the next value when i=3.
                                   Self Assessment


                                   Fill in the blanks:
                                   12.  The  initialization  statements  are  executed  once;  only  when  the  …………………  is
                                       encountered.
                                   13.  The do...while loop is a variant of the …………………

                                   5.7 JavaScript Objects

                                   JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to
                                   define your own objects and make your own variable types.
                                   However, creating your own objects will be explained later, in the Advanced JavaScript section.
                                   We will start by looking at the built-in JavaScript objects, and how they are used. The next pages
                                   will explain each built-in JavaScript object in detail.




                                     Notes  An object is just a special kind of data. An object has properties and methods.

                                   Properties

                                   Properties are the values associated with an object.
                                   In the following example we are using the length property of the String object to return the
                                   number of characters in a string:
                                          <script  type=”text/javascript”>
                                          var  txt=”Hello  World!”;
                                          document.write(txt.length);
                                          </script>
                                   Output
                                          12

                                   Methods

                                   Methods are the actions that can be performed on objects.



          150                               LOVELY PROFESSIONAL UNIVERSITY
   151   152   153   154   155   156   157   158   159   160   161