Mega Code Archive

 
Categories / JavaScript DHTML / Language Basics
 

A Demonstration of a Nested Loop

<html> <head>   <title>A Demonstration of a Nested Loop</title> </head><body>   <script type="text/javascript">   <!--     document.write("All x,y coordinates between (0,0) and (9,9):<br>")         for (var x = 0; x < 10; ++x) {       for (var y = 0; y < 10; ++y) {         document.write("(" + x + "," + y + "),");       }       document.write('<br>');     }         document.write("<br>After completing the loop, x equals : " + x);     document.write("<br>After completing the loop, y equals : " + y);   // -->   </script> </body> </html>