![]() |
VOOZH | about |
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. The _.dropRightWhile() function is used to delete the slice of the array excluding elements dropped from the end until the predicate function returns false.
Syntax:
_.dropRightWhile(array, [predicate=_.identity])Parameter:
Return: It returns the array.
Note: Install the lodash module by using the command
npm install lodashbefore using the code given below.
Example 1:
Output:
👁 ImageExample 2:
In this example, the predicate function returns false it does not check further and returns the sliced array. Please note that it is different from drop while as it drops element from the right side and not left.