-
Notifications
You must be signed in to change notification settings - Fork 26
Array Functions
array values have the following functions defined.
Note: The functions that return array just return the value they acted on, not a new value. This enables calls to be chained like this: [].add(1).add(2).add(3)
add(item): array
Adds item to the end of the array.
clear(): array
Removes all items from the array.
contains(item): bool
Returns true if the array contains item.
indexOf(item): number
Returns the index of the first occurrence of the item in the array, or -1 if it was not found.
insert(index: number, item): array
Inserts the item into the array at the given index.
lastIndexOf(item): number
Returns the index of the last occurrence of the item in the array, or -1 if it was not found.
remove(item): array
Removes the first occurrence of the item from the array.
removeAt(index: number): array
Removes the item at the given index from the array.
length(): number
Returns the number of items in the array.
getEnumerator(): object
Returns an enumerator for iterating over values in the array.