JavaScript array join method | Join the elements of an array into a string

JavaScript array join method is used to join the elements of an array into a string. You can use specified separators like space or other special characters etc. But the separator default value is a comma (,).

Note: this method will not change the original array.


Parameter Values

Its and optional and default value is comma(, ).

Return Value

A string with all array elements joined. If Array length is 0, the empty string is returned.

Examples of JavaScript array join method

Let’s see the example of how to Convert the elements of an array into a string using a join() function in js.


JavaScript array join method

Q: How to javascript join two arrays?

Answer: Use concat() method to join two or more arrays. It doesn’t t change the original arrays, but returns a new array, containing the values of the joined arrays.

Read more and Examples: JavaScript array concat | Method | merge (add) two arrays

Do comment if you have any doubts and suggestions on this tutorial.

Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.