# array\.prototype\.findlastindex 中文文档

规范地址：https://npmcn.com/package/array.prototype.findlastindex/

版本：1\.2\.6
npm 元数据更新时间：2025-03-14T18:20:03.426Z
中文译文更新时间：2026-11-05T16:15:39.342Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/array.prototype.findlastindex
原文对照：https://npmcn.com/package/array.prototype.findlastindex/?lang=original
项目主页：https://github.com/es-shims/Array.prototype.findLastIndex#readme
源码仓库：https://github.com/es-shims/Array.prototype.findLastIndex

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：30.5 kB，16 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>= 0\.4
- 运行依赖：7 个
- 首次发布：2021-07-14T06:37:50.147Z
- 最新版本发布：2025-03-14T18:20:03.256Z
- 近 30 天下载量：228053316（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：10（近 12 个月 0 个）

## 中文简介

一个符合ESnext的光谱 `Array.prototype.findLastIndex` shim/polyfill/取而代之,其效可达ES3.

## 安装

```sh
npm install array.prototype.findlastindex
```

也可以使用：`pnpm add array.prototype.findlastindex`、`yarn add array.prototype.findlastindex`、`bun add array.prototype.findlastindex`

## README

# 数组. prototype.findlastindex [![Version Badge](https://versionbadg.es/es-shims/Array.prototype.findLastIndex.svg)](https://npmjs.org/package/array.prototype.findlastindex)

[![github actions](https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.findLastIndex)](https://github.com/es-shims/Array.prototype.findLastIndex) [![coverage](https://codecov.io/gh/es-shims/Array.prototype.findLastIndex/branch/main/graphs/badge.svg)](https://app.codecov.io/gh/es-shims/Array.prototype.findLastIndex/) [![dependency status](https://david-dm.org/es-shims/Array.prototype.findLastIndex.svg)](https://david-dm.org/es-shims/Array.prototype.findLastIndex) [![dev dependency status](https://david-dm.org/es-shims/Array.prototype.findLastIndex/dev-status.svg)](https://david-dm.org/es-shims/Array.prototype.findLastIndex#info=devDependencies) [![License](https://img.shields.io/npm/l/array.prototype.findlastindex.svg)](https://npmcn.com/package/array.prototype.findlastindex/LICENSE) [![Downloads](https://img.shields.io/npm/dm/array.prototype.findlastindex.svg)](https://npm-stat.com/charts.html?package=array.prototype.findlastindex)

[![npm badge](https://nodei.co/npm/array.prototype.findlastindex.png?downloads=true&stars=true)](https://npmjs.org/package/array.prototype.findlastindex)

一个符合ESnext的光谱 `Array.prototype.findLastIndex` shim/polyfill/取而代之,其效可达ES3.

此软件包执行 [希姆・API](https://github.com/es-shims/api) 接口。 它在ES3支持的环境中工作,并遵守拟议 [光谱](https://tc39.es/proposal-array-find-from-last)。 。 。 .

因为 `Array.prototype.findLastIndex` 取决于接收器( `this` 值,主要导出以数组作为第一个参数.

## 开始

```sh
npm install --save array.prototype.findlastindex
```

## 使用/实例

```js
var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');

var arr = [1, [2], [], 3, [[4]]];
var isNumber = function (x) { return typeof x === 'number' };

assert.deepEqual(findLastIndex(arr, isNumber), 3);
```

```js
var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');
/* when Array#findLastIndex is not present */
delete Array.prototype.findLastIndex;
var shimmed = findLastIndex.shim();

assert.equal(shimmed, findLastIndex.getPolyfill());
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
```

```js
var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');
/* when Array#findLastIndex is present */
var shimmed = findLastIndex.shim();

assert.equal(shimmed, Array.prototype.findLastIndex);
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
```

## 测试

仅仅复制回转, `npm install`运行 `npm test`

## 常见问题

### array\.prototype\.findlastindex 是什么？

一个符合ESnext的光谱 Array\.prototype\.findLastIndex shim/polyfill/取而代之,其效可达ES3\.

### 如何安装 array\.prototype\.findlastindex？

在项目目录运行 npm install array\.prototype\.findlastindex，或使用 pnpm add / yarn add / bun add。

### array\.prototype\.findlastindex 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/array\.prototype\.findlastindex 是否存在。

### array\.prototype\.findlastindex 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### array\.prototype\.findlastindex 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>= 0\.4。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### array\.prototype\.findlastindex 可以商用吗？

array\.prototype\.findlastindex 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### array\.prototype\.findlastindex 的下载量有多少？

根据 npm 官方下载统计，array\.prototype\.findlastindex 在 2026/10/05 – 2026/11/03 这 30 天内被下载 228,053,316 次，日均约 7,601,777 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### array\.prototype\.findlastindex 还在维护吗？

最新版本 1\.2\.6 发布于 2025/03/15（1\.6 年前）；至今共发布 10 个版本，其中过去 12 个月发布了 0 个；首次发布于 2021/07/14。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

