Computer >> Computer tutorials >  >> Programming >> Javascript

How to concatenate multiple string variables in JavaScript?


To concatenate multiple string variables, use the JavaScript concatenation operator.

Example

You can try to run the following code to concatenate variables

Live Demo

<html>
   <body>
      <script>
         var str1 = "Tutorials ";
         var str2 = "Point: ";
         var str3 = "Simply Easy Learning"
         var res = str1 + str2 + str3;

         document.write("String 1 = "+str1);
         document.write("<br>String 2 = "+str2);
         document.write("<br>String 3 = "+str3);

         document.write("<br>After concatenaton: "+res);
      </script>
   </body>
</html>