Returns the first element in the array.
You can optionally specify a matching criteria using the property
and value
arguments.
For example: getAll('visible', true)
would return the first element that had its visible
property set.
Optionally you can specify a start and end index. For example if the array had 100 elements,
and you set startIndex
to 0 and endIndex
to 50, it would search only the first 50 elements.
name | type | arguments | Default | description |
---|---|---|---|---|
array | array |
The array to search. |
||
property | string | <optional> |
The property to test on each array element. |
|
value | * | <optional> |
The value to test the property against. Must pass a strict ( |
|
startIndex | number | <optional> | 0 |
An optional start index to search from. |
endIndex | number | <optional> | array.length |
An optional end index to search up to (but not included) |
The first matching element from the array, or null
if no element could be found in the range given.