String Operators
Assign 5 to x
let text1 = "Good";
let text2 = "Morning";
let text3 = text1 + " " + text2;
Try it Yourself »
JavaScript String Operators
The + operator, and the += operator can also be used to concatenate (add) strings.
Given that t1 = "Good ", t2 = "Morning", and t3 = "", the table below explains the operators:
Oper | Example | t1 | t2 | t3 | Try it |
---|---|---|---|---|---|
+ | t3 = t1 + t2 | "Good " | "Morning" | "Good Morning" | Try it » |
+= | t1 += t2 | "Good Morning" | "Morning" | Try it » |
For a tutorial about assignment operators, read our JavaScript Assignment Tutorial.
Browser Support
String Concatenation
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |