Examples of Concatenating Strings

The following example uses the addition (+) operator between two strings:

var proverb = "A rolling stone " + "gathers no moss.";

This example sets the value of the proverb variable to the following text:

A rolling stone gathers no moss.

The following example concatenates a string and a number:

var newstring = 4 + "get it";

This example sets the value of the new string variable to the following text:

4get it