JavaScript toString()Method
Example
Convert an array to a string:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.toString();
fruits.toString();
fruitsThe output will be:
Banana,Orange,Apple,Mango
Try it Yourself »
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 |
|---|
Other Extensions
JavaScript Array Object