![]() |
VOOZH | about |
Lodash _.takeRightWhile the method is used to create a slice of an array in which elements are taken from the end and these elements are taken until the predicate returns falsely.
_.takeRightWhile(array, [predicate=_.identity]);Example 1: In this example, we are getting an array of objects that satisfy the given condition in a function.
Output:
[{ user: 'fred', active: false }, {user: 'pebbles', active: false}]Example 2: In this example, we are getting an array of objects that satisfy the given condition in a function.
Output:
[{user: 'pebbles', active: false}]Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.