Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

zip(...arrays) ⇒ Array

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.

Returns: Array - Returns the new array of grouped elements.
Throws:

  • TypeError If any of the arguments is not array.
Param Type Description
...arrays Array The arrays to process.

Example

zip([1, 2, 3], [11, 22, 33], [111, 222, 333]);
// => [ [1, 11, 111], [2, 22, 222], [3, 33, 333] ]

zip([1, 2, 3], [11, 22, 33], [111, 222]);
// => [ [1, 11, 111], [2, 22, 222], [3, 33, undefined] ]

zip([1, 2, 3], [11, 22, 33], [111, 222]);
// => [ [1, 11, 111], [2, 22, undefined], [3, undefined, undefined] ]

zip([], []);
// => []

zip();
// => []