Languages
[Edit]
EN

JavaScript - merge two arrays

0 points
Created by:
elmer
646

In this short article, we would like to show how to merge two arrays in JavaScript.

Quick solution:

 

More examples

Edit

In this section, we present how to merge two arrays using the spread syntax.

Example 1

Edit

Output:

Example 2

Edit

Output:

See also

Edit
  1. JavaScript - merge two sorted arrays in optimal way

References

Edit
  1. Array.prototype.concat() - JavaScript | MDN 
  2. Spread syntax (...) - JavaScript | MDN

Alternative titles

  1. JavaScript - join two arrays to concatenate into one array
  2. JavaScript - combine two arrays to concatenate into one array
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join