Return the element at the specified index.
The first element is at(1)
, the last element is at(-1)
.
If the index is <0, return the element at index size() + index + 1
.
The index can also be a string for example for dictionaries.
If the index is invalid, return undefined
.
Return the index of the first element that matches the target expression.
The comparison is done using the target.isEqual()
method.
If the expression is not found, return undefined
.
If the expression is found, return the index, 1-based.
If the expression is found multiple times, return the index of the first
match.
From is the starting index for the search. If negative, start from the end and search backwards.
Optional
from: numberReturn an iterator
If there is a keys()
handler, there is no iterator()
handler.
Optional
start: numberOptional
count: numberIf the collection is indexed by strings, return the valid values for the index.
Return the number of elements in the collection. An empty collection has a size of 0.
The handlers are the primitive operations that can be performed on collections.
There are two types of collections:
size()
handler of finite collections returns the number of elementssize()
handler of infinite collections returnsInfinity
Infinite collections are not indexable, they have noat()
handler.