4 lines
140 B
JavaScript
4 lines
140 B
JavaScript
const takeRightWhile = (arr, func) =>
|
|
arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []);
|
|
module.exports = takeRightWhile;
|