Skip to content

JavaScript array to string with commas | Convert code

  • by

Use the join() method or toString() method to convert an array to a string with commas in JavaScript. And if you want to convert an array of objects into a string, then use the JSON.stringify method:


You can specify an empty string as an argument to join, if no argument is specified a comma is used.

Example JavaScript array to string with commas

A simple example code join() method returns an array as a string.

<!DOCTYPE html>


    let arr = ["ABC", "Is", "Popular","Language"];
    let res  = arr.join();





JavaScript array to string with commas

The method array.toString() actually calls array.join() which results in a string concatenated by commas.

var array = ['a','b','c','d','e','f'];

Output: “a,b,c,d,e,f”

Do comment if you have any doubts or suggestions on this JS convert array to string code.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *