Export (0) Print
Expand All

toString Method (Array)

Returns a string representation of an array.

array.toString()

array

Required. The array to represent as a string.

The string representation of the array.

The elements of an Array are converted to strings. The resulting strings are concatenated and separated by commas.

The following example illustrates the use of the toString method with an array.

var arr = [1, 2, 3, 4];
var s = arr.toString();
document.write(s);

// Output: 1,2,3,4

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2014 Microsoft