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; } me da [[1, undefined], [1, undefined]] en lugar de [[0, undefined], [1, undefined]]
Tan confundido en cuanto a por qué alguien puede explicar? ¿O me estoy perdiendo algo obvio?