I take this step by step to avoid some missunderstanding.
Introduction:
let's say I have two arrays.
var arr1= ['a', 'b', 'c'];
var arr2= ['d', 'e', 'f'];
and i need all combination from this two arrays with just single rule and that is that combination should be just between arrays never inside of array. For my example above ouput should be:
ad, ae, af, bd, be, bf, cd, ce, cf
Example code:
I tested code like this which provide me expecting result
var combinations = [];
arr1.forEach(function(a1){
arr2.forEach(function(a2){
combinations.push(a1 + a2);
});
});
This sound easy however it take me a while to figurate out. And now I face another problem which i wasnt able to solve after longer time.
Number of arrays is generated by user. So in this simple example of two arrays code above will work but if user say he want to combinate 3 arrays? or even more 10 arrays?
Question is:
How to dynamicly combinate all arrays user provide?