export function func() {
const test = new Array(2).fill(new Array(2))
for (let i = 0; i < test.length; i++) {
test[i][0] = i;
}
console.log(test)
return -1;
}
gives me [[1, undefined], [1, undefined]]
instead of [[0, undefined], [1, undefined]]
So confused as to why can anyone explain? Or am I missing something obvious?