the 2D array I'm dealing with might has different length on each row, like:
var a = [1, 2, 3];
var b = ["orange", "poke"];
var c = ["melon", "table", 93, 71, "rock"];
var arrayA = [a, b, c];
And the I want to get all the combinations of values from array like this:
var result = [arrayA[0][0], arrayA[1][0], arrayA[2][0]];
//some operation with result
result = [arrayA[0][0], arrayA[1][0], arrayA[2][1]];
//some operation with result
result = [arrayA[0][0], arrayA[1][0], arrayA[2][2]];
//some operation with result
.
.
.
.
.
.
result = [arrayA[0][2], arrayA[1][1], arrayA[2][4]];
//some operation with result
Is this possible to achieve these with loops while dealing with 2D array with various length of in the javascript? If not, is there other way to do this?Thx