xxxxxxxxxx
const filled1 = new Array(3).fill({ pizza: 'pizza' });
filled1[0].pizza = 'cake';
console.log(filled1);
//[{ pizza: 'cake' }, { pizza: 'cake' }, { pizza: 'cake' }]
const filled2 = Array.from({ length: 3 }, () => ({ pizza: 'pizza' }));
filled2[0].pizza = 'cake';
console.log(filled2);
// [{ pizza: 'cake' }, { pizza: 'pizza' }, { pizza: 'pizza' }]
// same thing happens with the new keyword (?)
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from