Advertisement
RokiAdhytama

Break Test - Chapter 9

Jul 2nd, 2022
735
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.57 KB | None
  1. <html xmlns = "http://www.w3.org/1999/xhtml">
  2.    <head>
  3.       <title>
  4.          Using the break Statement in a for Statement
  5.       </title>
  6.  
  7.       <script type = "text/javascript">
  8.          <!--
  9.          for ( var count = 1; count <= 10; ++count ) {
  10.             if ( count == 5 )
  11.                break;  // break loop only if count == 5
  12.  
  13.             document.writeln( "Count is: " + count + "<br />" );
  14.          }
  15.  
  16.          document.writeln(
  17.             "Broke out of loop at count = " + count );
  18.          // -->
  19.       </script>  
  20.  
  21.    </head><body></body>
  22. </html>
Advertisement
RAW Paste Data Copied
Advertisement