JavaScript toString()Method

Array 对象考手册JavaScript Array Object

Example

Convert an array to a string:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


Array 对象考手册JavaScript Array Object

Other Extensions