JavaScript Array join() Function Last Updated : 07 Jul, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The JavaScript Array.join() method is used to join the elements of the array together 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: [separator]: A string to separate each element of the array. By default, the array elements are separated by a comma( , ). Return Value: This function returns a string created by joining all the elements of the array using the separator.If the separator is not provided then the array elements are joined using a comma (, ) as it is the default separator for this function.If an empty string is provided as the separator then the elements are joined directly without any character in between them. If the array is empty then this function returns an empty string. Example 1: In this example, we will be joining the elements of an array using ( | ) by join() method. JavaScript function func() { let a = [1, 2, 3, 4, 5, 6]; console.log(a.join('|')); } func(); Output1|2|3|4|5|6 Example 2: In this example, the function join() joins together the elements of the array into a string using ', ' since it is the default value. JavaScript function func() { let a = [1, 2, 3, 4, 5, 6]; console.log(a.join()); } func(); Output1,2,3,4,5,6 Example 3: In this example, the function join() joins together the elements of the array into a string using ' ' (empty string). JavaScript function func() { let a = [1, 2, 3, 4, 5, 6]; console.log(a.join('')); } func(); Output123456 We have a complete list of Javascript Array methods, to check those please go through this Javascript Array Complete reference article. Supported Browsers: The browsers supported by JavaScript Array isArray() method are listed below: Google Chrome 5.0Microsoft Edge 12Mozilla Firefox 4.0Safari 5.0Opera 10.5 We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript. Comment More infoAdvertise with us Next Article JavaScript Array join() Function H HGaur Follow Improve Article Tags : Misc JavaScript Web Technologies javascript-array javascript-functions +1 More Practice Tags : Misc Similar Reads JavaScript Array join() Method The JavaScript Array 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(,).Syntaxarray.join(separator);ParametersThis method accepts a single parameter as mentioned above and des 2 min read TypeScript Array join() Method The Array.join() method in TypeScript is a built-in function used to join all the elements of an array into a single string. This method is particularly useful when you need to concatenate array elements with a specific separator.SyntaxHere, we will see the syntax of the join() method and understand 2 min read Node.js join() function join() is an array function from Node.js that is used to return a string from the array. Syntax: array_name.join(parameter) Parameter: This function takes a single parameter as per which the join operation has to be performed. Return type: The function returns the string. The program below demonstra 1 min read Arrays.toString() in Java with Examples The Arrays.toString() method belongs to the Arrays class in Java. It converts an array into its string representation consisting of a list of the array's elements. In the case of an Object Array, if the array contains other arrays as elements, their string representation shows memory addresses inste 3 min read ArrayDeque element() Method in Java The java.util.ArrayDeque.element() method in Java is used to retrieve or fetch the head of the ArrayDeque. In the process, the method does not delete the element from the deque instead it just returns the element. Syntax: Array_Deque.element() Parameters: The method does not take any parameter. Retu 2 min read Like