I'm not sure how this operation is called so I failed to google it.
I have a multiple 1-dimensional arrays and want to construct and array that contains all possible combinations of values from each array. So for example if I have 3 arrays:
["a", "b"], ["z", "x"], ["1", "2"]
I want to get a result:
[["a", "z", "1"],
["a", "z", "2"],
["a", "x", "1"],
["a", "x", "2"],
["b", "z", "1"],
["b", "z", "2"],
["b", "x", "1"],
["b", "x", "2"]]
The only way I can think of is making a recursive function that will pick an element from 1 array for each call. But that seems unnecessarily complex to me. Maybe there is much simpler solution or built in function for that?