Description
The toString() method is used to convert an array to a string and return the result.
This method has the form:
array.toString()
Note: The returned string will separate the elements in the array with commas.
Return Value
A String containing all the values of the array, separated by a comma
Examples
The following example shows the basic use of this method.
<script>
var colorNames = ['Red', 'Green', 'Blue'];
document.write(colorNames.toString());
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|