12345678910111213141516171819202122 |
- <header>
- <h1>Deep Copy</h1>
- </header>
- <body>
- <script>
- arr = [];
- for (let i = 0; i < 5; i++) {
- arr[i] = [];
- for (let j = 0; j < 5; j++) {
- arr[i][j] = (i + 1) * (j + 1);
- }
- }
- alert(arr);
- const deep = [];
- for (let i = 0; i < 5; i++) {
- deep[i] = [...arr[i]];
- }
- alert(deep);
- </script>
- </body>
|