I have this type of data
var arr = [
["A", "AA"],
["B"],
["C", "CC", "CCC"]
];
I want to get combinations of all the elements within each array. for e.g.
A B
A B C
A B CC
A B CCC
A C
A CC
A CCC
...
AA B CCC
Note the sequence of the words are same, like this should not be one of the combination B A C.
I tried a couple of logics but can't get what I am looking for. I can obtain all permutations and combinations of all the words, but that's not what I am looking for.
Please suggest