DEV Community

Discussion on: Merging Arrays in Javascript

Collapse
 
janjuks profile image
janjuks • Edited

sort() should be sort((a, b) => a - b)
Otherwise, surprise, surprise - [1, 2, 11].sort() -> [1, 11, 2]

Collapse
 
ethan profile image
Ethan Stewart

I forgot about that, good catch!