Files
30-seconds-of-code/test/dropRightWhile/dropRightWhile.js
2018-08-02 13:49:33 +03:00

6 lines
169 B
JavaScript

const dropRightWhile = (arr, func) => {
while (arr.length > 0 && !func(arr[arr.length - 1])) arr = arr.slice(0, -1);
return arr;
};
module.exports = dropRightWhile;