const y = [...Array(2)].map(() => Array(3).fill([]));
console.log('Before: ', JSON.stringify(y));
// Before: [[[],[],[]],[[],[],[]]]
y[0][1].push("foo");
console.log('After: ', JSON.stringify(y));
// After: [[["foo"],["foo"],["foo"]],[[],[],[]]]
Why is "foo" inserted three times ? And how can I insert "foo" only in the first one i.e. How can I get
// After: [[["foo"],[],[]],[[],[],[]]]