Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0
Firefox 122
Ubuntu
Desktop
9 months ago
Test name Executions per second
Array.apply(null, Array(n)) 24203.1 Ops/sec
[...Array(n)] 68449.0 Ops/sec
Array(n).fill(null) 110621.8 Ops/sec
Array.from({ length: n }) 108491.5 Ops/sec
Array.from({ length:n }, (item, i) => i) 140150.7 Ops/sec
Tests:
  • Array.apply(null, Array(n))

  • [...Array(n)]

  • Array(n).fill(null)

  • Array.from({ length: n })

  • Array.from({ length:n }, (item, i) => i)


;