Wednesday, May 17, 2017

How to convert Arrays to strings?

Convert method Arrays to Strings

The JavaScript method toString() converts an array to a string of (comma separated) array values.

Example

var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.toString();

Result

Banana,Orange,Apple,Mango

No comments:

Post a Comment