Class Array
TopLevel
Class Array
Object
Array
An Array of items.
Properties
length  :  Number
The length of the Array.
Constructor Summary
Array()
Constructs an Array.
Array(length : Number)
Constructs an Array of the specified length.
Array(values : Object...)
Constructs an Array using the specified values.
Method Summary
concat(values : Object...) : Array
Constructs an Array by concatenating multiple values.
copyWithin(target : Number, start : Number, end : Number) : Array
Copies elements within this array.
entries() : ES6Iterator
Returns an iterator containing all index/value pairs of this array.
every(callback : Function) : boolean
Returns true if every element in this array satisfies the test performed in the callback function.
every(callback : Function, thisObject : Object) : boolean
Returns true if every element in the thisObject argument satisfies the test performed in the callback function, false otherwise.
fill(value : Object, start : Number, end : Number) : Array
Sets multiple entries of this array to specific value.
filter(callback : Function) : Array
Returns a new Array with all of the elements that pass the test implemented by the callback function.
filter(callback : Function, thisObject : Object) : Array
Returns a new Array with all of the elements that pass the test implemented by the callback function that is run against the specified Array, thisObject.
find(callback : Function, thisObject : Object) : Object
Returns the first value within the array that satisfies the test defined in the callback function.
findIndex(callback : Function, thisObject : Object) : Number
Returns the index of the first value within the array that satisfies the test defined in the callback function.
forEach(callback : Function) : void
Runs the provided callback function once for each element present in the Array.
forEach(callback : Function, thisObject : Object) : void
Runs the provided callback function once for each element present in the specified Array, thisObject.
static from(arrayLike : Object, mapFn : Function, thisObject : Object) : Array
Creates a new array from an array-like object or an Iterable.
includes(valueToFind : Object, fromIndex : Number) : boolean
Returns if the array contains a specific value.
indexOf(elementToLocate : Object) : Number
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
indexOf(elementToLocate : Object, fromIndex : Number) : Number
Returns the first index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present.
static isArray(object : Object) : boolean
Checks if the passed object is an array.
join() : String
Converts all Array elements to Strings and concatenates them.
join(separator : String) : String
Converts all array elements to Strings and concatenates them.
keys() : ES6Iterator
Returns an iterator containing all indexes of this array.
lastIndexOf(elementToLocate : Object) : Number
Returns the last index at which a given element can be found in the array, or -1 if it is not present.
lastIndexOf(elementToLocate : Object, fromIndex : Number) : Number
Returns the last index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present.
map(callback : Function) : Array
Creates a new Array with the results of calling the specified function on every element in this Array.
map(callback : Function, thisObject : Object) : Array
Creates a new Array with the results of calling the specified function on every element in the specified Array.
static of(values : Object...) : Array
Creates a new array from a variable list of elements.
pop() : Object
Removes and returns the last element of the Array.
push(values : Object...) : Number
Appends elements to the Array.
reverse() : void
Reverses the order of the elements in the Array.
shift() : Object
Shifts elements down in the Array and returns the former first element.
slice(start : Number, end : Number) : Array
Returns a new Array containing a portion of the Array using the specified start and end positions.
some(callback : Function) : boolean
Returns true if any of the elements in the Array pass the test defined in the callback function, false otherwise.
some(callback : Function, thisObject : Object) : boolean
Returns true if any of the elements in the specified Array pass the test defined in the callback function, false otherwise.
sort() : Array
Sorts the elements of the Array in alphabetical order based on character encoding.
sort(function : Function) : Array
Sorts the elements of the Array in alphabetical order based on character encoding.
splice(start : Number, deleteCount : Number, values : Object...) : Array
Deletes the specified number of elements from the Array at the specified position, and then inserts values into the Array at that location.
toLocaleString() : String
Converts the Array to a localized String.
toString() : String
Converts the Array to a String.
unshift(values : Object...) : Number
Inserts elements at the beginning of the Array.
values() : ES6Iterator
Returns an iterator containing all values of this array.
Constructor Detail
Array
public Array()
Constructs an Array.

Array
public Array(length : Number)
Constructs an Array of the specified length.
Parameters:
length - the length of the Array.

Array
public Array(values : Object...)
Constructs an Array using the specified values.
Parameters:
values - zero or more values that are stored in the Array.

Method Detail
concat
concat(values : Object...) : Array
Constructs an Array by concatenating multiple values.
Parameters:
values - one or more Array values.
Returns:
a new Array containing the concatenated values.

copyWithin
copyWithin(target : Number, start : Number, end : Number) : Array
Copies elements within this array. The array length is not changed.
API Versioned:
From version 21.2.
Parameters:
target - The target of the first element to copy.
start - Optional. The first index to copy. Default is 0.
end - Optional. The index of the end. This element is not included. Default is copy all to the array end.
Returns:
This array.

entries
entries() : ES6Iterator
Returns an iterator containing all index/value pairs of this array. The iterator produces a series of two-element arrays with the first element as the index and the second element as the value.
API Versioned:
From version 21.2.

every
every(callback : Function) : boolean
Returns true if every element in this array satisfies the test performed in the callback function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Parameters:
callback - the function to call to determine if every element in this array satisfies the test defined by the function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Returns:
true if every element in this array satisfies the test performed in the callback function.
See Also:

every
every(callback : Function, thisObject : Object) : boolean
Returns true if every element in the thisObject argument satisfies the test performed in the callback function, false otherwise. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Parameters:
callback - the function to call to determine if every element in this array satisfies the test defined by the function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - the Object to use as 'this' when executing callback.
Returns:
true if every element in thisObject satisfies the test performed in the callback function, false otherwise.
See Also:

fill
fill(value : Object, start : Number, end : Number) : Array
Sets multiple entries of this array to specific value.
API Versioned:
From version 21.2.
Parameters:
value - The value to set.
start - Optional. The first index to copy. Default is 0.
end - Optional. The index of the end. This element is not included. Default is copy all to the array end.
Returns:
This array.

filter
filter(callback : Function) : Array
Returns a new Array with all of the elements that pass the test implemented by the callback function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Parameters:
callback - the function that is called on this Array and which returns a new Array containing the elements that satisfy the function's test. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Returns:
a new Array containing the elements that satisfy the function's test.

filter
filter(callback : Function, thisObject : Object) : Array
Returns a new Array with all of the elements that pass the test implemented by the callback function that is run against the specified Array, thisObject. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Parameters:
callback - the function that is called on the thisObject Array and which returns a new Array containing the elements that satisfy the function's test. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - the Object to use as 'this' when executing callback.
Returns:
a new Array containing the elements that satisfy the function's test.

find
find(callback : Function, thisObject : Object) : Object
Returns the first value within the array that satisfies the test defined in the callback function.
API Versioned:
From version 21.2.
Parameters:
callback - The function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - The object to use as 'this' when executing callback.
Returns:
The first value within the array that satisfies the test defined in the callback function, undefined if no matching value was found.

findIndex
findIndex(callback : Function, thisObject : Object) : Number
Returns the index of the first value within the array that satisfies the test defined in the callback function.
API Versioned:
From version 21.2.
Parameters:
callback - The function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - The object to use as 'this' when executing callback.
Returns:
The index of the first value within the array that satisfies the test defined in the callback function, -1 if no matching value was found.

forEach
forEach(callback : Function) : void
Runs the provided callback function once for each element present in the Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned a value.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.

forEach
forEach(callback : Function, thisObject : Object) : void
Runs the provided callback function once for each element present in the specified Array, thisObject. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned a value.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - the Object to use as 'this' when executing callback.

from
static from(arrayLike : Object, mapFn : Function, thisObject : Object) : Array
Creates a new array from an array-like object or an Iterable.
API Versioned:
From version 21.2.
Parameters:
arrayLike - An array-like object or an iterable that provides the elements for the new array.
mapFn - Optional. A function that maps the input elements into the value for the new array.
thisObject - Optional. The Object to use as 'this' when executing mapFn.
Returns:
The newly created array.

includes
includes(valueToFind : Object, fromIndex : Number) : boolean
Returns if the array contains a specific value.
API Versioned:
From version 21.2.
Parameters:
valueToFind - The value to look for.
fromIndex - Optional. The index to start from.
Returns:
true if the value is found in the array else false.

indexOf
indexOf(elementToLocate : Object) : Number
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
Parameters:
elementToLocate - the element to locate in the Array.
Returns:
the index of the element or -1 if it is no preset.

indexOf
indexOf(elementToLocate : Object, fromIndex : Number) : Number
Returns the first index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present.
Parameters:
elementToLocate - the element to locate in the Array.
fromIndex - the index from which to start looking for the element.
Returns:
the index of the element or -1 if it is no preset.

isArray
static isArray(object : Object) : boolean
Checks if the passed object is an array.
Parameters:
object - The object to ckeck.
Returns:
true if the passed object is an array else false.

join
join() : String
Converts all Array elements to Strings and concatenates them.
Returns:
a concatenated list of all Array elements as a String.

join
join(separator : String) : String
Converts all array elements to Strings and concatenates them.
Parameters:
separator - an optional character or string used to separate one element of the Array from the next element in the return String.
Returns:
a concatenated list of all Array elements as a String where the specified delimiter is used to separate elements.

keys
keys() : ES6Iterator
Returns an iterator containing all indexes of this array.
API Versioned:
From version 21.2.

lastIndexOf
lastIndexOf(elementToLocate : Object) : Number
Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards.
Parameters:
elementToLocate - the element to locate in the Array.
Returns:
the index of the element or -1 if it is no preset.

lastIndexOf
lastIndexOf(elementToLocate : Object, fromIndex : Number) : Number
Returns the last index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present. The array is searched backwards.
Parameters:
elementToLocate - the element to locate in the Array.
fromIndex - the index from which to start looking for the element. The array is searched backwards.
Returns:
the index of the element or -1 if it is no present.

map
map(callback : Function) : Array
Creates a new Array with the results of calling the specified function on every element in this Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Returns:
a new Array with the results of calling the specified function on every element in this Array.

map
map(callback : Function, thisObject : Object) : Array
Creates a new Array with the results of calling the specified function on every element in the specified Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - the Object to use as 'this' when executing callback.
Returns:
a new Array with the results of calling the specified function on every element in this Array.

of
static of(values : Object...) : Array
Creates a new array from a variable list of elements.
API Versioned:
From version 21.2.
Parameters:
values - The array values.
Returns:
The newly created array.

pop
pop() : Object
Removes and returns the last element of the Array.
Returns:
the last element of the Array.

push
push(values : Object...) : Number
Appends elements to the Array.
Parameters:
values - one or more values that will be appended to the Array.
Returns:
the new length of the Array.

reverse
reverse() : void
Reverses the order of the elements in the Array.

shift
shift() : Object
Shifts elements down in the Array and returns the former first element.
Returns:
the former first element.

slice
slice(start : Number, end : Number) : Array
Returns a new Array containing a portion of the Array using the specified start and end positions.
Parameters:
start - the location in the Array to start the slice operation.
end - the location in the Array to stop the slice operation.
Returns:
a new Array containing the members bound by start and end.

some
some(callback : Function) : boolean
Returns true if any of the elements in the Array pass the test defined in the callback function, false otherwise.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
Returns:
true if any of the elements in the Array pass the test defined in the callback function, false otherwise.

some
some(callback : Function, thisObject : Object) : boolean
Returns true if any of the elements in the specified Array pass the test defined in the callback function, false otherwise.
Parameters:
callback - the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
thisObject - the Object to use as 'this' when executing callback.
Returns:
true if any of the elements in the Array pass the test defined in the callback function, false otherwise.

sort
sort() : Array
Sorts the elements of the Array in alphabetical order based on character encoding.

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

Returns:
a reference to the Array.

sort
sort(function : Function) : Array
Sorts the elements of the Array in alphabetical order based on character encoding.

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

Parameters:
function - a Function used to specify the sorting order.
Returns:
a reference to the Array.
See Also:

splice
splice(start : Number, deleteCount : Number, values : Object...) : Array
Deletes the specified number of elements from the Array at the specified position, and then inserts values into the Array at that location.
Parameters:
start - the start location.
deleteCount - the number of items to delete.
values - zero or more values to be inserted into the Array.

toLocaleString
toLocaleString() : String
Converts the Array to a localized String.
Returns:
a localized String representing the Array.

toString
toString() : String
Converts the Array to a String.
Returns:
a String representation of the Array.

unshift
unshift(values : Object...) : Number
Inserts elements at the beginning of the Array.
Parameters:
values - one or more vales that will be inserted into the beginning of the Array.
Returns:
the new length of the Array.

values
values() : ES6Iterator
Returns an iterator containing all values of this array.
API Versioned:
From version 21.2.