

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to extend an existing JavaScript array with another array?
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
- Related Questions & Answers
- JavaScript in filter an associative array with another array
- Filter one array with another array - JavaScript
- Sort an array according to another array in JavaScript
- Modify an array based on another array JavaScript
- Filter JavaScript array of objects with another array
- How to add new value to an existing array in JavaScript?
- How to extend the size of an array in Java
- How to extend an array after initialization in android listview?
- How to filter an array from all elements of another array – JavaScript?
- JavaScript - filtering array with an array
- How to replace elements in array with elements of another array in JavaScript?
- Empty masked array with the properties of an existing array in Numpy
- How to wrap an existing element with another one in jQuery?
- Sorting Array based on another array JavaScript
- Java Program to extend the size of an Integer array
Advertisements