const grid = [[1, 2], [3, 4]]; // a spread copy shares the nested arrays const shallow = [...grid]; shallow[0].push(99); console.log(grid[0]);
inner objects are still shared