The array-like object to search.
The value to locate in the array. Values are
compared using strict ===
equality.
The index of the first element in the range to be
searched, inclusive. The default value is 0
. Negative values
are taken as an offset from the end of the array.
The index of the last element in the range to be
searched, inclusive. The default value is -1
. Negative values
are taken as an offset from the end of the array.
The index of the first occurrence of the value, or -1
if the value is not found.
If stop < start
the search will wrap at the end of the array.
Linear.
A start
or stop
which is non-integral.
import { ArrayExt } from '@lumino/algorithm';
let data = ['one', 'two', 'three', 'four', 'one'];
ArrayExt.firstIndexOf(data, 'red'); // -1
ArrayExt.firstIndexOf(data, 'one'); // 0
ArrayExt.firstIndexOf(data, 'one', 1); // 4
ArrayExt.firstIndexOf(data, 'two', 2); // -1
ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1
Find the index of the first occurrence of a value in an array.