I am facing a challenge with creating rules from three arrays that I have. The task is to generate every possible combination of entries from each array, but I am struggling with the logic required to write a function for this purpose. For example:
var array1 = [1, 2];
var array2 = [3, 4, 5];
var array4 = [6, 7, 8, 9, 10];
I would like to receive a result containing all possible combinations in the format of strings or objects. An example output could be:
var result = ["1-3-6", "2-3-6", "1,4,6"];
I have attempted using a For Loop to solve this problem, but I am unsure how to proceed. I also considered using maps, but did not find any relevant examples. The total number of combinations based on my calculations should be 84 (2 * 7 * 6) considering the number of entries in each array.
I hope this explanation is clear, though I understand it might be somewhat confusing. Additionally, I am looking for a solution using Angular JS or vanilla JavaScript if possible, but other methods are also welcome.