JavaScript String concat() Method

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

Syntax

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

Parameter

str1,str2,...,strn - It represent the strings to be combined.

Return

Combination of strings.

JavaScript String concat() Method Example

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

Example 1

Here, we will print the combination of two strings.

Test it Now

Output:

Javatpoint.com

Example 2

Here, we will print the combination of three strings.

Test it Now

Output:

Javatpoint.com Tutorials

Example 3

In the last example, we provided the space between the strings while initializing it. Here, we will perform the similar task through the method.

Test it Now

Output:

Javatpoint.com Tutorials





Latest Courses