DEV Community

Discussion on: 2 Ways to Merge Arrays in JavaScript

Collapse
 
samanthaming profile image
Samantha Ming

Interesting, thanks for writing out the test! Good to keep in mind if you need to optimize the code. But I wonder as spread become more popular, if the browser will start optimizing it ... maybe concat is faster because it’s been around longer and the browser is deciphering it 🤔

Collapse
 
agronick profile image
Kyle Agronick

I wondered that too. You would think it would just call concat internally. I'm not sure what would cause the huge difference.