The lodash _.zip method and other related topics
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.
1 - What to know with lodash zip and more before continuing
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.
1.2 - Multidimensional arrays as just a single linear array
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.
2 - Basic example of _.zip
_.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.
3 - _.zip, _.unzip, _.flatten, and _.chunk
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.
4 - Conclusion
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.