Add findLastIndex, update findLast

This commit is contained in:
Angelos Chalaris
2018-01-24 13:02:07 +02:00
parent ffe73704cd
commit 85cbc34bc4
2 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,7 @@ Returns the last element for which the provided function returns a truthy value.
Use `Array.filter()` to remove elements for which `fn` returns falsey values, `Array.slice(-1)` to get the last one.
```js
const findLast = (arr, fn) => arr.filter(fn).slice(-1);
const findLast = (arr, fn) => arr.filter(fn).slice(-1)[0];
```
```js