Thursday, September 4, 2025
HomeLanguagesJavascriptTypeScript Array concat() Method

TypeScript Array concat() Method

The Array.concat() is an inbuilt TypeScript function which is used to merge two or more arrays together. 
Syntax:

array.concat(value1, value2, ..., valueN)

Parameter: This method accepts a single parameter multiple time as mentioned above and described below: 

  • valueN : These parameters are arrays and/or values to concatenate.

Return Value: This method returns the new array. 
Below examples illustrate the Array concat() method in TypeScript
Example 1: 

JavaScript




<script>
    // Driver code
    var num1 = [11, 12, 13];
    var num2 = [14, 15, 16];
    var num3 = [17, 18, 19]; 
  
    // use of String concat() Method
    console.log(num1.concat(num2, num3)); 
</script>


Output: 

[ 11, 12, 13, 14, 15, 16, 17, 18, 19 ]

Example 2: 

JavaScript




<script>
    // Driver code
    var num1 = ['a', 'b', 'c'];
  
    // use of String concat() Method
    console.log(num1.concat(1, [2, 3])); 
</script>


Output: 

[ 'a', 'b', 'c', '1,2,3' ]
RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS