JavaScript Array toString() Method
Example
Convert an array to a string:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x =
fruits.toString();
Try it Yourself »
Definition and Usage
The toString()
method returns a string with
all the array values, separated by commas.
Note: This method will not change the original array.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
toString() | Yes | Yes | Yes | Yes | Yes |
Syntax
array.toString()
Parameters
None |
Technical Details
Return Value: | A String, representing the values of the array, separated by a comma |
---|---|
JavaScript Version: | ECMAScript 1 |
Related Pages
JavaScript Tutorial: JavaScript Arrays
JavaScript Tutorial: JavaScript Data Types
❮ JavaScript Array Reference