I was trying to get an array with some arrays inside of it, and each of those inner arrays should contain ONE of the n powers of 2, not all.
let n = 5;
let arr = Array(n + 1).fill([]);
const transform = function (el, i) {
el.push(2 ** i);
};
console.log(arr); // [Array(0), Array(0), Array(0), Array(0), Array(0), Array(0)]
arr.map(transform);
console.log(arr); //[Array(6), Array(6), Array(6), Array(6), Array(6), Array(6)]
//was expecting //[[1], [2], [4], [8], [16], [32]]