-
Notifications
You must be signed in to change notification settings - Fork 24
Array Functions
array
values have the following functions defined.
- add
- clear
- contains
- indexOf
- insert
- lastIndexOf
- remove
- removeAt
- sort
- sortDescending
- length
- getEnumerator
add(item)
Adds item to the end of the array.
clear()
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)
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): bool
Removes the first occurrence of the item from the array. Returns true
if an item was removed.
removeAt(index: number)
Removes the item at the given index from the array.
sort()
sort(index: number, count: number)
In-place sorts the contents of the array in ascending order.
sortDescending()
sortDescending(index: number, count: number)
In-place sorts the contents of the array in descending order.
length(): number
Returns the number of items in the array.
getEnumerator(): object
Returns an enumerator for iterating over values in the array.