Implement a function dropRightWhile(array, predicate) that removes elements from the end of an array until the predicate returns false.
array: The array to iterate over.predicate: A function invoked with each element, index, and the whole array. Stop dropping when predicate returns false.Example
dropRightWhile([1, 2, 3, 4], n => n > 2); // [1, 2] dropRightWhile([1, 2, 3, 4], n => n < 4); // [1, 2, 3, 4]
JavaScript Function
No test results yet
Click "Run" to execute tests