Hacker News new | ask | show | jobs
by eyelidlessness 1565 days ago
> Avoid giving the initial capacity to the array

This isn’t necessarily right. It’s perfectly fine to do:

  Array(n).fill()
Which returns a dense array.
1 comments

It performs a copy, does nothing to the initial array.