Can\'t figure out how to create an array with all matches. I suppose I need a recursive function for this.
I like to get all values from the JSON below and create an ar
var indices = [];
var lengths = [];
for (i = 0; i<models.length; i++) {
indices[i] = 0;
lengths[i] = models[i].values.length;
}
var matches = [];
while (indices[0] < lengths[0]) {
var row = [];
for (i = 0; i<indices.length; i++) {
row.push(models[i].values[indices[i]]);
}
matches.push(row);
/* Cycle the indexes */
for (j = indices.length-1; j >= 0; j--) {
indices[j]++;
if (indices[j] >= lengths[j] && j != 0) {
indices[j] = 0;
} else {
break;
}
}
}