Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133
Windows
Desktop
one year ago
Array(n).fill(undefined)
3K/s
for loop push
567/s
Array.apply(null, { length: 4 })
373/s
[...Array(n).keys()].map(k => undefined)
239/s
Array.from
212/s
View exact numbers
Test name Executions per second
Array(n).fill(undefined) 2,618 Ops/sec
for loop push 567 Ops/sec
Array.apply(null, { length: 4 }) 373 Ops/sec
[...Array(n).keys()].map(k => undefined) 239 Ops/sec
Array.from 212 Ops/sec
Script Preparation code:
Tests: