Page 108 - PortGPT_V2.1_C8_Flipbook
P. 108

<BODY>
                  <H3> Using continue Statement</H3>

                  <SCRIPT>
                  var i;
                  for(i=1; i <= 10; i++)
                  {
                      if(i==6)
                      {

                        continue;
                      }
                      document.write(i + "<BR>");
                  }
                  </SCRIPT>

                  </BODY>
                  </HTML>
                  The output of the Program 6 is:





















                  In the preceding output, you can see that the number 6 is not displayed as the continue statement is
                  executed when the value of the variable i becomes 6.


                   Let’s Practice                                                                  Computational Thinking


                    Write a program in JavaScript to find the given number is prime or not.
                    ________________________________________________________________________________

                    ________________________________________________________________________________

                    ________________________________________________________________________________
                    ________________________________________________________________________________

                    ________________________________________________________________________________








                  106   Premium Edition-VIII
   103   104   105   106   107   108   109   110   111   112   113