TypeScript Array concat() Method
The Array.concat() is an inbuilt TypeScript function which is used to merge two or more arrays together.
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
num1 = [11, 12, 13];
num2 = [14, 15, 16];
num3 = [17, 18, 19];
[ 11, 12, 13, 14, 15, 16, 17, 18, 19 ]
num1 = [
console.log(num1.concat(1, [2, 3]));
[ 'a', 'b', 'c', '1,2,3' ]
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!