How to concatenate multiple string variables in JavaScript?

JavascriptWeb DevelopmentFront End Technology

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>
raja
Published on 24-Jan-2018 06:26:37
Advertisements