hw06_05.html 541 B

12345678910111213141516171819202122232425
  1. <header>
  2. <h1>Multiply table</h1>
  3. </header>
  4. <body>
  5. <script>
  6. arr = [];
  7. for (let i = 1; i <= 5; i++) {
  8. arr[i] = [];
  9. for (let j = 1; j <= 5; j++) {
  10. arr[i][j] = i * j;
  11. }
  12. }
  13. let str = "";
  14. for (let i = 1; i <= 5; i++) {
  15. for (let j = 1; j <= 5; j++) {
  16. val = arr[i][j];
  17. str += ' ' + val.toString().padStart(2, ' ');
  18. }
  19. str += '\n'
  20. }
  21. alert(str);
  22. </script>
  23. </body>