isLastIndex
The isLastIndex() function indicates whether an index corresponds to the last element of an array. It is curried to fit easily into compositions or reductions.
Interactive example
Syntax
Classic signature
typescript
function isLastIndex<
GenericInput extends readonly unknown[],
>(
input: GenericInput,
index: number,
): booleanCurried signature
typescript
function isLastIndex<
GenericInput extends readonly unknown[],
>(
index: number,
): (input: GenericInput) => booleanParameters
input: Target array.index: Index to test.
Return value
true if index points to the last element of the array, false otherwise.
See also
lastIndexOf- Gives the index of the last occurrencelength- Returns the size of an arrayreduce- Reduces an array to one value
