# \_.findLastIndex(array, predicate=_.identity , fromIndex=array.length-1 )

URL: https://caijiao.org/lodash/docs/Array/_.findLastIndex
Source: docs/lodash/docs/Array/_.findLastIndex.md
Description: _.findLastIndex(array, [predicate=.identity], [fromIndex=array.length-1]) 该方法类似 _.findIndex，不同之处在于它从右到左遍历集合中的元素。

该方法类似 \_.findIndex，不同之处在于它从右到左遍历集合中的元素。

## 自

2.0.0

## 参数

`array (Array)`： 要检查的数组。

`[predicate=_.identity] (Function)`： 每次迭代调用的函数。

[fromIndex=array.length-1]（数字）： 要搜索的索引。

## 返回值

(数字）： 返回找到的元素的索引，否则返回-1。

## 示例

```JavaScript
var users = [
  { 'user': 'barney',  'active': true },
  { 'user': 'fred',    'active': false },
  { 'user': 'pebbles', 'active': false }
];

_.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
// => 2

// The `_.matches` iteratee shorthand.
_.findLastIndex(users, { 'user': 'barney', 'active': true });
// => 0

// The `_.matchesProperty` iteratee shorthand.
_.findLastIndex(users, ['active', false]);
// => 2

// The `_.property` iteratee shorthand.
_.findLastIndex(users, 'active');
// => 0
```
