- Lodash Tutorial
- Lodash - Home
- Lodash - Overview
- Lodash - Environment Setup
- Lodash - Array
- Lodash - Collection
- Lodash - Date
- Lodash - Function
- Lodash - Lang
- Lodash - Math
- Lodash - Number
- Lodash - Object
- Lodash - Seq
- Lodash - String
- Lodash - Util
- Lodash - Properties
- Lodash - Methods
- Lodash Useful Resources
- Lodash - Quick Guide
- Lodash - Useful Resources
- Lodash - Discussion
Lodash - zip method
Syntax
_.zip([arrays])
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 elements 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 ] ]
lodash_array.htm
Advertisements
To Continue Learning Please Login
Login with Google