avr39ripe

jsNestedLoopsExample

Feb 1st, 2021 (edited)
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Study</title>
  6. </head>
  7. <body>
  8.     <script>
  9.         `use strict`
  10.         /*
  11.         0: 0 1 2 3 4 5
  12.         1: 0 1 2 3 4 5
  13.         2: 0 1 2 3 4 5
  14.         */
  15.         let maxY = 6;
  16.         let maxX = 10;
  17.         let messageStr = '';
  18.  
  19.         for (let y = 0; y <= maxY; ++y) {
  20.             messageStr = `${y}: `;
  21.             for (let x = 0; x <= maxX; ++x) {
  22.                 messageStr += `${x} `;
  23.             }
  24.             console.log(messageStr);
  25.         }
  26.  
  27.         console.log('Job is DONE! :)');
  28.        
  29.  
  30.     </script>
  31. </body>
  32. </html>
  33.  
Add Comment
Please, Sign In to add comment