How to concatenate several strings in JavaScript?

JavascriptWeb DevelopmentFront End Technology

To concatenate several string, use “Array.join()” method. Here, we will concat the following strings:

John
Amit
Sachin

Example

You can try to run the following code to concat several strings

Live Demo

<html>
   <body>
      <script>
         var arr = ['Amit', 'John', 'Sachin'];
         document.write(arr.join(', '));
       </script>
   </body>
</html>
raja
Published on 24-Jan-2018 06:24:47
Advertisements