![]() |
With the help of _.iterators.select() method, we can get the values from iteration function whenever we got true from unary predicate function when we invoked the iterator by using this method. Syntax: _.iterators.select(iter, unaryPredicateFn) Parameter: This method accepts two parameter as mentioned above and described below:
Return value: Return the values from iteration function.
Note: To execute the below examples you have to install the underscore-contrib library by using this command prompt we have to execute the following command.
npm install underscore-contrib
Example 1: In this example, we can see that by using _.iterators.select() method, we are able to get the values from iteration function whenever we got true from unary predicate function every time it invoked.
Javascript
Output : Geeks for Geeks Example 2: Javascript
Output : 1 3 5 7 |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 9 |