Javascript concat() Method - Array Function

How can we concat the elements in javascript array?
What is array Concatenation method?

Explanation

Method: concat() :
This function is used to concat two or more arrays into a single array. The concatenation function appends the second array with first array.
Syntax:
array1.concat(array2,array3,...arrayx);

Example:


<script language="javascript">
var alphabets = ["a", "b","c"];
var numbers = ["1", "2"];
var symbols = ["@", "$","^"];
var alphano = alphabets.concat(numbers,symbols);
document.write(alphano);
</script>

Result:



Thus, array concatenation can be carried out by using this function.

Ask Questions

Ask Question