_.zip, which can be used to zip two arrays together.
const array1 = ['a', 'b', 'c']; const array2 = [1, 2, 3]; const zippedArray = _.zip(array1, array2); console.log(zippedArray);
[ ['a', 1], ['b', 2], ['c', 3] ]
_.zip function takes two arrays as arguments and returns a new array of arrays, where each inner array contains the elements from the corresponding index of each array.
In the example above,
array1 contains the elements
array2 contains the elements
3. The resulting
zippedArray contains the elements
See more codes...