devxlogo

Convert an Array Into a String in JavaScript

Convert an Array Into a String in JavaScript

If you want to convert an array into a sting, the join method is your best bet. This method takes one parameter and uses it as the separator between each array element as it is added to the string. Although spaces, commas, and dashes are common separators, you can forego a separator completely by specifying an empty string (“”) as the parameter. So a command like myarray.join(“”) will create a string with nothing between the array elements.

 The result is 

devx-admin

Share the Post: