Array
QuickLinks
Properties
Property | Type | Access | Description |
---|---|---|---|
length | number | r/w | The length of the array |
Methods
Constructor
Array Array (length:
number[, element:
any])
Creates and returns a new array.
Takes any number of parameters, which become the elements of the array, or a single value which becomes the length of an empty array. Note that you cannot create a one-element array, as the single parameter value is interpreted as the length. Returns the new array.
Parameter | Type | Description |
---|---|---|
length | number | If no other parameters are passed, the initial length of the empty array. Otherwise, the first element. |
element | any | If there is more than one parameter, the array is initialized with the given parameters. (Optional) |
Example |
new Array() new Array (length) new Array (11, 22, 33, 44) |
Instances
Array concat (value:
any)
Returns a new array created by concatenating the given values to the end of the original array.
The original array is unchanged. If an array is provided as a parameter to concat(), each of its elements are appended as separate array elements at the end of the new array. Returns a new array, the result of concatenation the given values to the end of the original array.
Parameter | Type | Description |
---|---|---|
value | any | Any number of values to be added to the end of the array. Can also be arrays. |
Example | array.concat(value1,...valueN) |
string join ([delimiter:
string])
Joins all elements of the array into a string; optionally, each element is separated by delimiter.
Returns the string containing the joined elements and delimiters.
Parameter | Type | Description |
---|---|---|
delimiter | string | A string used to separate each element of the array. If omitted, the array elements are separated with a comma. (Optional) |
Example | array.join(delimiter) |
any pop ()
Removes the last element from the array, decreases the length by 1, and returns the value of the element.
Returns the value of the deleted array element.
Example | array.pop() |
number push (value:
number)
Places one or more values onto the end of the array and increases length by n.
Returns the new length of the array.
Parameter | Type | Description |
---|---|---|
value | number | Any number of values to be pushed onto the end of the array. |
Example | array.push(value1,...valueN) |
Array reverse ()
Reverses the order of the elements in the array.
Returns the reversed array.
Example | array.reverse() |
any shift ()
Removes the first element from the array, decreases the length by 1, and returns the value of the element.
Returns the value of the deleted array element.
Example | array.shift() |
Array slice ()
Creates a new array, which contains a subset of the original array's elements.
The slice begins with the index start, and continues up to, but not including the index, end. If start or end is a negative number, the indexed is resolved counting backwards from the end of the array resulting in the element array[array. length + negativeIndex]. Returns a new array containing elements array[start] through array[end-1].
Example | array.slice(start, end) |
void sort (userFunction:
Function)
Sorts the elements of the array in place, using the given function to compare to elements.
If no function is provided, the elements are sorted alphabetically. Returns no return value.
Parameter | Type | Description |
---|---|---|
userFunction | Function | A user-supplied function of the form userFunction(a, b) which returns less than 0 if a is greater than b, 0 if a and b are equal, and greater than 0 if b is greater than a. |
Example | array.sort(userFunction) |
Array splice (start:
number[, num:
number][, value:
any])
Removes num elements from the array beginning with index, start.
Optionally insert new elements beginning at index start. To ensure contiguity, elements are moved up to fill in any gaps. Returns a new array containing any elements deleted from the original array.
Parameter | Type | Description |
---|---|---|
start | number | The index of the first element to remove. Negative values are relative to the end of the array. |
num | number | The number of array elements to remove, including start. If omitted, all elements from array index start to the end of the array are removed. (Optional) |
value | any | A list of one or more values to be added to the array starting at index start. Must specify a value for num, to use this argument. (Optional) |
Example | array.splice(start, num, value1, ...valuen) |
string toLocaleString ()
Converts an array to a string and returns the string (localized).
string toSource ()
Creates a string representation of this object that can be fed back to eval() to re-create an object. Works only with built-in classes.
string toString ()
Converts an array to a string and returns the string.
Yields the same result as array. join() when called without a parameter. Returns a comma-separated list of all the elements of the array.
Example | array.toString() |
number unshift (value:
any)
Adds one or more elements to the beginning of the array.
Returns the new array length.
Parameter | Type | Description |
---|---|---|
value | any | The values of one or more elements to be added to the beginning of the array. |
Example | array.unshift(value1,...valuen) |
Element of
ListItem.subItems
Used in:
any Function.apply (thisObj: Object, args: Array)
Return
Array Array.Array (length: number[, element: any])
Array Array.concat (value: any)
Array Array.reverse ()
Array Array.slice ()
Array Array.splice (start: number[, num: number][, value: any])
Array Folder.getFiles (mask: any)
Array RegExp.exec (text: string)
Array String.match (regexp: RegExp)
Array XML.inScopeNamespaces ()
Array XML.namespaceDeclarations ()
Jongware, 25-Nov-2012 v3.0.3i | Contents :: Index |