How to append an array to another in JavaScript ?

Published on June 20, 2016 by abundantcode

Filed under JavaScript

Last modified June 20, 2016

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 1.5 (2 votes)

This article have been viewed 1101 times

In JavaScript , you may want to append one array to another array(s) to combine their elements resulting in to a single array.

How to append an array to another in JavaScript ?

You can use the concat method of JavaScript to achieve the same. Below is a sample code snippet demonstrating the usage of the concat method of array in JavaScript to combine multiple arrays.

    <script type="text/javascript">       
        var inputArray1 = ['abundant', 'code'];
        var inputArray2 = ['.', 'com'];
        var inputArray3 = [' website'];
        var ConcatenatedOutputString = inputArray1.concat(inputArray2, inputArray3);


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment