The + plus string operator is used to concatenate (join together) two or more strings.
document.write("bread " + "and " + "cheese");
This example joins together the three strings 'bread', 'and' and 'cheese' to produce 'bread and cheese'.
document.write("milk and " + x);
Assuming 'x' to contain the string 'honey', this returns 'milk and honey'.
var x = 'milk and ';
x += "honey";
document.write(x);
milk and honeyThe shorthand assignment operator can also be used to concatenate strings. If the variable 'x' has the value 'milk and ', then the following code will add the string 'honey' to the value in variable 'x' producing the new string 'milk and honey'.