create new array with 5 elements

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
Array.from({ length: 5 }, (_ ,index) => ({
  id: `element-${index}`,
}))
ready
Array(5).keys()
[...Array(5).keys()].map((index) => ({
  id: `element-${index}`,
}))
ready
[...Array(5)].map
[...Array(5)].map((_, index) => ({
  id: `element-${index}`,
}))
ready
Array fill
Array(5).fill(0).map((index) => ({
  id: `element-${index}`,
}))
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.