// fill stores the SAME array in every slot
const rows = Array(3).fill([]);
rows[0].push(1);
console.log(rows);
// Array.from builds an independent object per slot
const safe = Array.from({ length: 3 }, () => []);
safe[0].push(1);
console.log(safe);Array(n).fill puts the same object everywhere