Array.join()
SWiSH Player Support
SWF5 or later - Supported Internally
Syntax
arrayName .join({ sep });
Arguments
sep : An optional character or string to be used as the separator for the string that returns the new array elements. Without this optional argument, a comma is used by default.
Returns
Nothing.
Description
Method; takes the individual elements of an array and converts them to strings. They are joined together by the character or string specified by the sep argument and returns a string containing the joined elements.
Sample s
onLoad() {
days = new Array ("Monday","Tuesday","Wednesday");
trace(days.join());
}
// displays "Monday,Tuesday,Wednesday" in the debug window
onLoad() {
days = new Array ("Monday","Tuesday","Wednesday");
trace(days.join(":"));
}
// displays "Monday:Tuesday:Wednesday" in the debug window
onLoad() {
pets = new Array ("fluffy","spot","Mr.Kitty");
trace(pets.join(" and "));
}
// displays "fluffy and spot and Mr.Kitty" in the debug window