To extend an existing array in JavaScript, use the Array.concat() method.
Example
You can try to run the following code to extend an existing JavaScript array with another array:
<html> <head> <title>JavaScript Array push Method</title> </head> <body> <script> var numbers = new Array(1, 4, 9); var numbers2 = new Array(2, 5); numbers = numbers.concat(numbers2); document.write("new numbers is : " + numbers ); </script> </body> </html>
Output
new numbers is : 1,4,9,2,5