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.
<html> <head> <script type="text/javascript"> var inputArray1 = ['abundant', 'code']; var inputArray2 = ['.', 'com']; var inputArray3 = [' website']; var ConcatenatedOutputString = inputArray1.concat(inputArray2, inputArray3); console.log(ConcatenatedOutputString); </script> </head> <body> </body> </html>
Leave a Reply