JavaScript String concat()
Examples
Join two strings:
let text1 = "sea";
let text2 = "food";
let result = text1.concat(text2);
Try it Yourself »
Join two strings:
let text1 = "Hello";
let text2 = "world!";
let result = text1.concat(" ", text2);
Try it Yourself »
More examples below.
Description
The concat()
method joins two or more strings.
The concat()
method does not change the existing strings.
The concat()
method returns a new string.
Syntax
string.concat(string1, string2, ..., stringX)
Parameters
Parameter | Description |
string1, string2, ... stringX | Required. The strings to be joined. |
Return Value
Type | Description |
A string | A new string containing the combined strings. |
More Examples
Join three strings:
let text1 = "Hello";
let text2 = "world!";
let text3 = "Have a nice day!";
let result = text1.concat(" ", text2, " ", text3);
Try it Yourself »
Browser Support
concat()
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |