So since JavaScript doesn't let you copy array using "=" I have to write this code. But it doesn't work
let arr = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
];
var arrclone = [];
for (let x = 0; x < arr.length; x++) {
  for (let y = 0; y < arr[x].length; y++) {
    arrclone[x][y] = arr[x][y];
  }
}
console.log(arrclone);
It said
arrclone[x][y] = arr[x][y];
                    ^
TypeError: Cannot set property '0' of undefined. 
How is it undefined both of them are already been declared. Sorry, I am a beginner sorry if my question seems stupid.
 
     
     
     
    