Could someone please assist me with looping through an array of variable sizes? Here is the array:
var x = [[1,2,3],[8],[10,11,12],[13]];
I am trying to create combinations in a new array. For example:
y = [[1,8,10,13],[2,8,10,13],[3,8,10,13],
[1,8,11,13],[2,8,11,13],[3,8,11,13]....]
I hope this explanation is clear. Here is what I have attempted so far:
for(var i=0; i<x.length; i++)
{
for(var ii=0; x[i].length; ii++)
{
//At this point I have x[0], but each number needs to be part of a combination
}
}
My end goal is to create combinations across multiple lists, such as the one below with 4 lists:
1 5 8 12
2 6 11
3 9
4 10