From http://www.w3schools.com (Copyright Refsnes Data)

JavaScript toString() Method


Array Object Reference JavaScript Array Object

Definition and Usage

The toString() method converts an array to a string and returns the result.

Syntax

arrayObject.toString()


Tips and Notes

Note: The elements in the array will be separated with commas.


Example

Example

In this example we will create an array and convert it to a string:

<script type="text/javascript">

var arr = new Array(3);
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";

document.write(arr.toString());

</script>

The output of the code above will be:

Jani,Hege,Stale

Try it yourself »


Array Object Reference JavaScript Array Object

From http://www.w3schools.com (Copyright Refsnes Data)