What is intended behavior for += with 2D arrays in JavaScript?
let matrix = new Array(3).fill(new Array(3).fill(0));
matrix[0][0] += 1;
console.log(matrix); //[[1, 0, 0], [1, 0, 0], [1, 0, 0]]
Why the output is
[[1, 0, 0], [1, 0, 0], [1, 0, 0]]
and not
[[1, 0, 0], [0, 0, 0], [0, 0, 0]]
Is this intended behavior?