I'm using Array.fill to prepopulate an array with other arrays. Modifying the array of one indices also modifies the array of another. Meaning its the same object.
const arr = Array(2).fill([]);
arr[0].push('a');
arr[1].push('b');
// [['a', 'b'], ['a', 'b']]
I've been reading through some documentation but I don't see this behavior mentioned anywhere. Same thing happens with an object literal.
Does this make sense somehow?