The Wayback Machine - https://web.archive.org/web/20211105135832/https://www.geeksforgeeks.org/javascript-array-join-method/amp/

JavaScript Array join() Method

Below is the example of the Array join() method.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

The arr.join() method is used to join the elements of an array into a string. The elements of the string will be separated by a specified separator and its default value is a comma(, ).

Syntax:

array.join(separator)

Parameters: This method accept single parameter as mentioned above and described below:



1, 2, 3, 4, 5, 6

Program 2:




<script> 
   function func() { 
      var a = [ 1, 2, 3, 4, 5, 6 ]; 
      document.write(a.join('')); 
   
   func(); 
</script> 

Output:

123456

Supported Browsers: The browsers supported by JavaScript Array join() method are listed below:




Article Tags :