![]() |
With the help of _.iterators.mapcat() method, we can get the function iterator which when called return the value which is flattening the contents of iterator and combined with the unary function by using this method. Syntax: _.iterators.mapcat(iter, unaryFn) Parameters: This method accepts two parameter as mentioned above and described below:
Return value: Return the function iterator which generate the value by mapping with unaryFn.
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 Below example illustrate the Underscore.js _.iterators.mapcat() method in JavaScript: Example 1: In this example, we can see that by using _.iterators.mapcat() method, we are able to get the function iterator which can generate the value after mapping with the unary function by using this method.
Javascript
Output : 1 1 2 Example 2: Javascript
Output: 0 1 0 0 0 |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |