JavaScript String concat()

The concat() method concatenates given arguments to the given string.

Example


concat() Syntax

The syntax of the concat() method is:

str.concat(str1, ..., strN)

Here, str is a string.


concat() Parameters

The concat() method takes in an arbitrary number of strings to concatenate to str.


concat() Return Value

  • Returns a new string containing the combined text of the strings provided.

Note: The assignment operators like + and += are strongly recommended over the concat() method.


Example: Using concat() method

Output

[object Object]
null
true
45
Hello, World!

Recommended Reading: JavaScript Array concat()