merging arrays

Benchmark created on


Description

combine two array into a single

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
const heroes = ['Batman', 'Superman'];
const villains = ['Joker', 'Bane','Loki','Sauron'];

const all = heroes.concat(villains);
ready
Flat
const heroes = ['Batman', 'Superman'];
const villains = ['Joker', 'Bane','Loki','Sauron'];

const all = [heroes, villains].flat();
ready
Spread Operator
const heroes = ['Batman', 'Superman'];
const villains = ['Joker', 'Bane','Loki','Sauron'];

const all = [...heroes, ...villains];
ready
Push
const heroes = ['Batman', 'Superman'];
const villains = ['Joker', 'Bane','Loki','Sauron'];

const all = heroes.push(...villains);
ready
Concat 2
const heroes = ['Batman', 'Superman'];
const villains = ['Joker', 'Bane','Loki','Sauron'];

const all = [].concat(heroes,villains);
ready

Revisions

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