Categories
JavaScript Answers

How to join or combine two arrays to concatenate into one JavaScript array?

Spread the love

To join or combine two arrays to concatenate into one JavaScript array, we call the concat method.

For instance, we write

const a = ["a", "b", "c"];
const b = ["d", "e", "f"];
const c = a.concat(b);

to call a.concat with b to return a new array with the entries in a followed by the entries in b.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *