The lodash _.zip method can be used to zip some separate arrays into one array of arrays. It is one of several helpful methods in lodash for working with multi-dimensional arrays, as _.zip can be used as a way to create them. Another such method that is helpful with these sorts of arrays is the _.chunk method that can be used to make a multi deferential array from a single array, while _.zip can make them from two, or more arrays. In addition there is also the lodash flatten method that can flatten and array of arrays into a single array that should also be worth checking out if you are now aware of it just yet.
So now that we have this out of the way, we can now look into some ways to go about creating this kind of array, from two or more other arrays with lodash methods. Including you guessed it the lodash zip method.
Another way of having a Multidimensional is as just a single array that follows a pattern when it comes to the index values. In that case it is just a matter of knowing the proper expression that needs to be used to get and set elements in the matrix. For an example of this consider the following.
_.zip works by making the first element of the first array given to it also the first element of the first array in what is returned, but then the second element in what is returned comes from the first element in the second array given to it, and so forth. _.unzip can then be used to unzip what is returned back into a collection of the original arrays that where given.
So if I have a bunch of single stand alone arrays, and I want to zip them together into an array of arrays I can do that with _.zip. I can then unzip them back into the way there where before using _.unzip. Another method of interest is _.flatten that will flatten an array of arrays into a single array, and then _.chunk can be used to break it back down into an array of arrays with a given width.
So _.zip is a useful method, and it seems like a good match with the _.chunk, method that will break a linear array into an array of arrays. There is also the _.flatten method as well that can be used to flatten an array of arrays into a linear array.