JSFiddle - React, Tailwind, and code Playground

by sjpt

JavaScript

ld = [ {step:1, length: 3}, {step:3, length: 4} ];
ld.size = 3*4;

/** find the next pos based on the ld */
function next(pos, ld) {
	for (var i=0; ; i++) {
		pos[i]++;
		if (pos[i] < ld[i].length) return;
		pos[i] = 0;
	}
}

function nl() { document.write("<br>"); }
pos = [0,0];
for (i=0; i<ld.size; i++) {
document.write(pos);
nl();
next(pos, ld);
}