---
title: "How to Efficiently Merge Arrays in JavaScript"
url: https://daily.dev/posts/how-to-efficiently-merge-arrays-in-javascript-78sifdejw
source_url: https://javascript.plainenglish.io/efficiently-merging-arrays-in-javascript-32993788a8b2
type: article
source: "Medium"
published: 2022-02-20T10:15:50.292Z
updated: 2022-02-20T10:15:50.297Z
tags: ["general-programming", "javascript"]
reading_time: 6
upvotes: 33
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Efficiently Merge Arrays in JavaScript

**[Medium](https://daily.dev/sources/medium_js)** · 6 min read · 33 upvotes · 1 comments

## Summary

The safest approach is to use the concat method of an Array object to merge two Arrays. If speed is critical, you may consider using the spread syntax and the Array object’s push method. The concat function is the de-facto standard for merging arrays in JavaScript.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://javascript.plainenglish.io/efficiently-merging-arrays-in-javascript-32993788a8b2>

## Community discussion

Top comments from developers on daily.dev.

**@random\_user** · 1 upvotes

> What about using spread how it most commonly is by spreading into an new declaration all at once like:
> `array1 = [...array1, ...array2]`
>
> Or using push without spreading into it with it's apply method:
> `array1.push.apply(array1,array2)`
>
> In my tests (chrome only) the first one is quite slow despite being the most common pattern, while the second is consistently slightly faster than concat and been around almost as long.  another interesting alternative at least.  thanks for the writeup and analysis.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#general-programming](https://daily.dev/tags/general-programming), [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/how-to-efficiently-merge-arrays-in-javascript-78sifdejw)
