![]() |
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 Loadsh.dropWhile() method is used to return the slice of the given array. This takes a predicate function that iterates through each element of the array and if the function returns false, it returns the sliced array excluding elements dropped from the beginning.
Syntax:
dropWhile(array, [predicate=_.identity])Parameters:
Return Value: It returns the new array after slicing.
Note: Please install lodash module by using command
npm install lodashbefore using the code given below.
Example 1:
Output:
👁 ImageExample 2: When array of object is given.