JavaScript toString() Method
Example
Converts an array to a string:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.toString();
fruitsWill output:
Banana,Orange,Apple,Mango
Try it »
Definition and Usage
The toString() method converts an array to a string and returns the result.
Note: The elements in the array are separated by commas.
Browser support





All major browsers support toString().
Syntax
array
.toString()
Return Value
| Type | Description |
|---|---|
| String | All values of the array are separated by commas |
Technical Details
| JavaScript version: | 1.1 |
|---|
JavaScript Array object