Concatenation is the process of joining two or more strings. Strings can be joined in three ways:
- + operator
- += operator
- concat function
Each of them is shown with an example as follows:
- The + operator
- The += operator
- The concat function
The + operator can be used to concatenate the strings as follows:
alert(”My name is “+name)
The output is shown in the image below:

The += operator can be used as follows:
tag+=”<head><title>My web page </title></head>”
tag+=”<body><p>This is my first web page </body>
tag+=”</html>”
The output is shown in the image below:

The concat function belongs to a string object and it can be used to combine strings. The following code will demonstrate this:
The output is shown in the image below:
