*Please open your browser console to see the log of the table.
const n = 5;
const m = 4;
const vl = new Array(n).fill(Array.from({length: m}, (v, i) => false))
console.table(vl)
vl[0][0] = true
console.table(vl)
I was trying to change only one value of [0][0], but it is changing the whole column as true
.
Not sure what's happening behind the scene. Maybe is it related to 2d array initialization?