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 ParameterTypeDescription
array1ArrayThe array to process.
array2ArrayThe array to process.
arrayN (optional)ArrayThe array to process.

Return value

Type
Array<any>

Sample

ExampleResultDescription
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