Syntax Of Lodash zip method
_.zip([arrays])
The Lodash zip method creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second element of the given arrays, and so on.
Arguments
- [arrays] (…Array) − The arrays to process.
Output
- (Array) − Returns the new array of grouped elements.
Example
var _ = require('lodash'); var result = _.zip(['a', 'b'], [1, 2], [true, false]); console.log(result);
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
[ [ 'a', 1, true ], [ 'b', 2, false ] ]
Next Topic – Click Here
Pingback: Lodash - Array - Adglob Infosystem Pvt Ltd
Thanks so much for the blog post.Really thank you! Awesome.