zip
Modified on Fri, 18 Aug 2023
Description
Create 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.
Syntax
zip(array1, array2, arrayN)
Parameters
Input Parameter | Type | Description |
---|---|---|
array1 | Array | The array to process. |
array2 | Array | The array to process. |
arrayN (optional) | Array | The array to process. |
Return value
Type |
---|
Array<any> |
Sample
Example | Result | Description |
---|---|---|
zip(['a', 'b'], [1, 2]) | [['a', 1], ['b', 2]] | Zip two arrays |
zip(['a', 'b'], [1, 2], [true, false]) | [['a', 1, true], ['b', 2, false]] | Zip three arrays |
zip(['a', 'b'], [1, 2], [true, false], [1.0, 2.0]) | [['a', 1, true, 1.0], ['b', 2, false, 2.0]] | Zip four arrays |
To view all the List functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article