Ways to copy an Array

Benchmark created on


Setup

let arr = [0,1,2,3,4,5,6,7,8,9]

Test runner

Ready to run.

Testing in
TestOps/sec
destructuring
[...arr]
ready
concat
arr.concat()
ready
constructor
new Array(arr).flat()
ready
arrayOf
Array.of(arr).flat()
ready

Revisions

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