# \_.findLast(collection, predicate=_.identity , fromIndex=collection.length-1 )

URL: https://caijiao.org/lodash/docs/Collection/_.findLast
Source: docs/lodash/docs/Collection/_.findLast.md
Description: _.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1]) 用于在集合中从右向左查找第一个满足条件的元素，并返回该元素。

`_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])` 用于在集合中从右向左查找第一个满足条件的元素，并返回该元素。

- `collection`：要查找的集合，可以是数组、对象或类数组对象。
- `predicate`（可选）：用于查找每个元素的条件函数，默认为 `_.identity` 函数。
- `fromIndex`（可选）：开始查找的索引位置，默认为集合的最后一个索引。

应用举例：

```javascript
// 原始集合
const collection = [1, 2, 3, 4, 5];

// 查找从右向左第一个小于 4 的元素
const result = _.findLast(collection, (n) => n < 4);

console.log(result);
// 输出：3
```

在这个例子中，`_.findLast` 方法从右向左查找了原始集合中第一个小于 4 的元素，并返回了该元素的值 `3`。
