JavaScript Concatenation


What is concatenation and how we can concatenates different JavaScript entities?

Basically, concatenation is the process of joining or combining the two entities. We can concatenate two variables , variables and string , functions etc.

Concatenation Joining Two Strings.

Syntax of Concatenation in JavaScript

'string1' + 'string2';

Concatenation of String and variable

<script type="text/javascript"> var mystring = "Hello to the"; var concatenation = mystring+"CodingPk Easy JavaScript Tutorials "; </script>

Concatenation of variable with left and right strings in JavaScript

<script type="text/javascript"> var mystring = "Reforms"; var concatenation = "A reformer is one who brings "+mystring+" in the society ."; alert(concatenation); </script>

Output of above Concatenation

Chapter Next »