DEV Community

Merging Two or More Arrays in JavaScript

Nathan on September 11, 2021

There often comes a time in JavaScript when you need to combine two or more arrays. I'll begin with a basic example, demonstrating how you can eas...
Collapse
 
queekusme profile image
Annie Kennedy

I dunno if there are any performance implications but I always do
[
…arr1,
…arr2
]

With the spread operator

Collapse
 
natclark profile image
Nathan

Interesting, I'm not sure what the performance implications would be. If I had time, I'd run a few quick tests to see!