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 elements of the given arrays, and so on.
参数
[arrays] (...Array) − The arrays to process.
输出:
(Array) − Returns the new array of grouped elements.
实例:
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.
命令:
输出:
[ [ 'a', 1, true ], [ 'b', 2, false ] ]