> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# findLastIndex (Functional Programming) es-toolkit

Creates a function that returns the index of the last value that passes a test. Use it with [`pipe`](https://massaman.dev/reference/fp/pipe.md).

```typescript
const result = pipe(array, findLastIndex(predicate));
```

::: info

This helper is specific to `es-toolkit/fp`. Use it when you want this operation as part of a [`pipe`](https://massaman.dev/reference/fp/pipe.md) pipeline.

:::

## Usage

`findLastIndex` searches the piped array from the end and returns the index of the first value for which `predicate` returns `true`. If no value matches, it returns `-1`.

```typescript
import { findLastIndex, pipe } from 'es-toolkit/fp';

pipe(
  [1, 2, 3, 4],
  findLastIndex(value => value % 2 === 0)
); // => 3
```

#### Parameters


predicate(value: T, index: number) => booleanrequired

The function that tests each value.

#### Returns

A function that maps a `readonly T[]` to the last matching index, or `-1`.

```typescript
(array: readonly T[]) => number
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/fp/reference/findLastIndex.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
