How to concatenate several strings in JavaScript?


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>

Updated on: 09-Jan-2020

156 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements