Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-19 18:51:03 +03:00
parent f0fbe0c3e5
commit 5e8e6f51a3
36 changed files with 97 additions and 82 deletions

View File

@ -5,7 +5,8 @@ tags: array,beginner
Returns the last element for which the provided function returns a truthy value.
- Use `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.
- Use `Array.prototype.filter()` to remove elements for which `fn` returns falsy values.
- Use `Array.prototype.pop()` to get the last element in the filtered array.
```js
const findLast = (arr, fn) => arr.filter(fn).pop();