Section 24.18. Array.toString( ): convert an array to a string


24.18. Array.toString( ): convert an array to a string

ECMAScript v1: Overrides Object.toString( )

24.18.1. Synopsis

array.toString( )

24.18.1.1. Returns

A string representation of array.

24.18.1.2. Throws

TypeError

If this method is invoked on an object that is not an Array.

24.18.2. Description

The toString( ) method of an array converts an array to a string and returns the string. When an array is used in a string context, JavaScript automatically converts it to a string by calling this method. On some occasions, however, you may want to call toString( ) explicitly.

toString( ) converts an array to a string by first converting each array element to strings (by calling its toString( ) method). Once each element is converted to a string, toString( ) outputs them in a comma-separated list. This return value is the same string that would be returned by the join( ) method with no arguments.

24.18.3. See Also

 Array.toLocaleString( ), Object.toString( ) 




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net