
Array.join() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
445
// Create an array
settings = ["on", "off"];
// Append an array containing a nested array
options = settings.concat(["brightness", ["high", "medium", "low"]]);
// Sets options to: ["on", "off", "brightness", ["high", "medium", "low"]]
// not: ["on", "off", "brightness", "high", "medium", "low"]
See Also
Array.push(), Array.shift(), Array.splice(); “The concat() Method,” in Chapter 11
Array.join() Method
convert an array to a string
Flash 5
array.join()
array.join(delimiter)
Arguments
delimiter An optional string to be placed between elements in the newly created string.
Defaults to a comma if not supplied.
Returns
A string composed of all the elements of array, converted to strings and separated by
delimiter.
Description
The join() method returns a string created by combining all the elements of an array, as
follows:
1. Convert each element in the array to a string according to the rules specified in
Table 3-2 in Chapter 3.
2. Add
delimiter to the end of each converted-element string, except the last one.
3. Concatenate the converted-element strings into one long string.
Note that elements that are themselves arrays are converted to strings via the toString()
method, so nested array elements are always delimited by commas, not by the delimiter ...