Update snippet descriptions
This commit is contained in:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user