I'm trying to get all the possible combinations of a 3d array.
I found a lot of answers for one- or two-dimensional arrays with recursive functions but no solution works for a deeper nested array.

The array structure is always the same (three levels), but the length of each level can change.

example code:

```
function getCombinations(arr){
  ...
}

var arr = [[[100, 200]], [[10, 20], [30, 40]]];
var arr2 = [[[100, 200]], [[10, 20], [50]], [[400, 500, 600]]];

res = getCombinations(arr);
res2 = getCombinations(arr2);

```

expected outputs:

```
// arr: [[[100, 200]], [[10, 20], [30, 40]]]
[
    [[100], [10, 30]],
    [[100], [10, 40]],

    [[100], [20, 30]],
    [[100], [20, 40]],

    [[200], [10, 30]],
    [[200], [10, 40]],

    [[200], [20, 30]],
    [[200], [20, 40]],
];

// arr2: [[[100, 200]], [[10, 20], [50]], [[400, 500, 600]]]
[
    [[100], [10, 50], [400]],
    [[100], [10, 50], [500]],
    [[100], [10, 50], [600]],

    [[100], [20, 50], [400]],
    [[100], [20, 50], [500]],
    [[100], [20, 50], [600]],

    [[200], [10, 50], [400]],
    [[200], [10, 50], [500]],
    [[200], [10, 50], [600]],

    [[200], [20, 50], [400]],
    [[200], [20, 50], [500]],
    [[200], [20, 50], [600]],
];

```