We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

String Operators Redirect 1

Jump to:


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, "my " + "string" returns the string "my string".

The shorthand assignment operator += can also be used to concatenate strings. For example, if the variable mystring has the value "alpha", then the expression mystring += "bet" evaluates to "alphabet" and assigns this value to mystring.

var mystring = "tooth";
var yourstring = "brush";
var ourstring = mystring + yourstring;
console.log(ourstring) // Prints "toothbrush"
var mystring = "alpha";
console.log(mystring += "bet"); // Prints "alphabet"
Implemented in: JavaScript 1.0
ECMA Version: ECMA-262


Document Tags and Contributors

 Contributors to this page: Sheppy
 Last updated by: Sheppy,