Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns = "http://www.w3.org/1999/xhtml">
- <head>
- <title>A Programmer-Defined square Function</title>
- <script type = "text/javascript">
- <!--
- document.writeln(
- "<h1>Square the numbers from 1 to 10</h1>" );
- // square the numbers from 1 to 10
- for ( var x = 1; x <= 10; ++x )
- document.writeln( "The square of " + x + " is " +
- square( x ) + "<br />" );
- // The following square function's body is executed
- // only when the function is explicitly called.
- // square function definition
- function square( y )
- {
- return y * y;
- }
- // -->
- </script>
- </head><body></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement