Advertisement
RokiAdhytama

SquareInt - Chapter 10

Jun 26th, 2022
971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.77 KB | None | 0 0
  1. <html xmlns = "http://www.w3.org/1999/xhtml">
  2.    <head>
  3.       <title>A Programmer-Defined square Function</title>
  4.  
  5.       <script type = "text/javascript">
  6.          <!--
  7.         document.writeln(
  8.            "<h1>Square the numbers from 1 to 10</h1>" );
  9.      
  10.         // square the numbers from 1 to 10
  11.         for ( var x = 1; x <= 10; ++x )
  12.            document.writeln( "The square of " + x + " is " +
  13.               square( x ) + "<br />" );
  14.  
  15.         // The following square function's body is executed  
  16.         // only when the function is explicitly called.
  17.  
  18.         // square function definition
  19.         function square( y )
  20.         {
  21.            return y * y;
  22.         }
  23.         // -->
  24.       </script>
  25.  
  26.    </head><body></body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement