I'm using this design pattern analogously to C++'s std::vector::reserve
:
> Array(3).map(k=>5)
[ <3 empty items> ]
> Array(3).fill(null).map(k=>5)
[ 5, 5, 5 ]
Clearly it's not a bug, as same functionality in Node.JS, Chrome and Firefox. But why does it act like this?