Javatpoint Logo
Javatpoint Logo

JavaScript Array concat() Method

The JavaScript array concat() method combines two or more arrays and returns a new string. This method doesn't make any change in the original array.

Syntax

The concat() method is represented by the following syntax:

Parameter

arr1,arr2,....,arrn - It represent the arrays to be combined.

Return

A new array object that represents a joined array.

JavaScript Array concat() Method Example

Let's see some examples of concat() method.

Example 1

Here, we will print the combination of two arrays.

Test it Now

Output:

C,C++,Python,Java,JavaScript,Android

Example 2

Here, we will print the combination of three arrays.

Test it Now

Output:

C,C++,Python,Java,JavaScript,Android,Ruby,Kotlin

Example 3

In this example, we will concat the elements directly.

Test it Now

Output:

C,C++,Python,Java,JavaScript,Android

Next TopicJavaScript Array





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA