DEV Community

Discussion on: Javascript Array.push is 945x faster than Array.concat 🤯🤔

Collapse
 
johncip profile image
jmc • Edited

it's not very obvious to people that concat creates a new array instead of modifying the first array

I always forget too 😂

Thread Thread
 
joineral32 profile image
Alec Joiner

FWIW, to me it is very intuitive that concat would create a new array since when I hear the word 'concat' I immediately think of strings. Maybe it's misguided, but that leads me to expect other things to behave the same way strings would.