JavaScript String concat()
Example
Join two strings:
let str1 = "Hello ";
let str2 = "world!";
let res = str1.concat(str2);
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The concat() method joins two or more strings.
concat() does not change the existing strings, but returns a new string.
Browser Support
concat() is fully supported in all browsers:
| Chrome | IE | Edge | Firefox | Safari | Opera |
| Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
string.concat(string1, string2, ..., stringX)
Parameter Values
| Parameter | Description |
|---|---|
| string1, string2, ..., stringX | Required. The strings to be joined |
Technical Details
| Return Value: | A new String, containing the text of the combined strings |
|---|---|
| JavaScript Version: | ECMAScript 1 |
More Examples
Example 2
Join three strings:
let str1 = "Hello ";
let str2 = "world!";
let str3 = " Have a nice day!";
let res = str1.concat(str2, str3);
Try it Yourself »

