Travis build: 568
This commit is contained in:
@ -5,7 +5,8 @@ Removes elements from the end of an array until the passed function returns `tru
|
||||
Loop through the array, using a `Array.prototype.reduceRight()` and accumulating elements while the function returns falsy value.
|
||||
|
||||
```js
|
||||
const takeRightWhile = (arr, func) => arr.reduceRight((acc, el) => func(el) ? acc : [el, ...acc], []);
|
||||
const takeRightWhile = (arr, func) =>
|
||||
arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []);
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user