so i filled this 2D array with 0 and then changing the first value in the first row of this 2D array but it changes the first value in every row, anyone know why this is happening?
let arr = Array<number[]>(5).fill(Array<number>(5).fill(0));
arr[0][0] = 10;
console.log(arr);
output
[
[ 10, 0, 0, 0, 0 ],
[ 10, 0, 0, 0, 0 ],
[ 10, 0, 0, 0, 0 ],
[ 10, 0, 0, 0, 0 ],
[ 10, 0, 0, 0, 0 ]
]
expected output
[
[ 10, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ]
]```