Page 152 - Computer Software Application TP - Volume 1
P. 152

COMPUTER SOFTWARE APPLICATION - CITS




              </head>
              <body>
              <script>
              const person = { name: “Alice”, age: 30 };
              for (const key in person)
              {
              console.log(key, person[key]);
              }
              </script>
              </body>
              </html>
           3  Save the program as a .html file
           4  Open the html file with a web browser
           5  Go to the browsers console tab and verify the output.

















           TASK 9 : Using for loop and -Iterate through values of iterable objects (arrays, strings etc.)
           1  Open the text editor
           2  Write the following codes
              <html >

              <head>
              <title> for loop </title>
              </head>
              <body>
              <script>

              const numbers = [1, 2, 3, 4, 5];
              for (const number of numbers)
              {
              console.log(number);
              }

              </script>
              </body>
              </html>
           3  Save the program as a .html file
           4  Open the html file with a web browser

           5  Go to the browsers console tab and verify the output.


                                                           137
 CITS : IT & ITES - Computer Software Application - Exercise 39  CITS : IT & ITES - Computer Software Application - Exercise 39
   147   148   149   150   151   152   153   154   155   156   157