JavaScript/String operators
[i]Learn· Expressions and operators

String operators

In addition to the comparison operators, which can be used on string values, the concatenation operator (+) concatenates two string values together, returning another string that is the union of the two operand strings.

For example,

console.log("my " + "string"); // console logs the string "my string".

The shorthand assignment operator += can also be used to concatenate strings.

For example,

let myString = "alpha";
myString += "bet"; // evaluates to "alphabet" and assigns this value to myString.
Source: Expressions and operators by Mozilla Contributors, licensed under CC-BY-SA-2.5. Retrieved 2026-11-18. Changes: Extracted the section "String operators"; removed the code-block language labels; made links absolute; examples are the page's own code blocks, unchanged.