hw06_11.html 428 B

12345678910111213141516171819202122
  1. <header>
  2. <h1>Deep Copy</h1>
  3. </header>
  4. <body>
  5. <script>
  6. arr = [];
  7. for (let i = 0; i < 5; i++) {
  8. arr[i] = [];
  9. for (let j = 0; j < 5; j++) {
  10. arr[i][j] = (i + 1) * (j + 1);
  11. }
  12. }
  13. alert(arr);
  14. const deep = [];
  15. for (let i = 0; i < 5; i++) {
  16. deep[i] = [...arr[i]];
  17. }
  18. alert(deep);
  19. </script>
  20. </body>