Files
30-seconds-of-code/test/dropRightWhile/dropRightWhile.js
2018-01-26 20:13:34 +00:00

5 lines
163 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