Files
30-seconds-of-code/test/takeRightWhile/takeRightWhile.js
2018-09-20 18:10:31 +04:00

3 lines
136 B
JavaScript

const takeRightWhile = (arr, func) => arr.reduceRight((acc, el) => func(el) ? acc : [el, ...acc], []);
module.exports = takeRightWhile;