I created a new 2d matrix filled with zeros:
const matrix = new Array(10).fill(new Array(10).fill(0));
matrix[0][0] = -1
When I try to change the value at matrix[row][col], it changes every value in the first row of the matrix.
[
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0],
[-1,0,0,0,0,0,0,0,0,0]
]