JS COPY 2D Array
let matrix = [
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
]
// copies just values, not references!
function getCopyOfMatrix(mat) {
return mat.map(row => row.map(col => col))
}
let copyOfMatrix = getCopyOfMatrix(matrix);
Ill Ibex