Using Lodash _.zip() function

Medium
0.0% Acceptance

In this lab, you will learn about the Lodash _.zip() function which is used to combine multiple arrays by merging their values together at corresponding indices. You will be writing your implementation of this function, exporting it, and passing tests to verify that your implementation is correct.

The function should work as follows:

  • Accept an arbitrary number of arrays as arguments*
  • Return a new array where each element is an array that contains values from all input arrays at the same index.

For example:

const result = _.zip([1, 2, 3], ['one', 'two', 'three']) console.log(result) // [['1', 'one'], ['2', 'two'], ['3', 'three']]

*Note: Though Lodash's _.zip() function can handle an infinite number of arrays, in this lab, we will limit the input to a maximum of 3 arrays for simplicity.