I have the below loop:
while (flatArray.length > 0)
nestedArray.push(nestedArray.splice(0, ROW_SIZE));
It meant to convert a flat array into a two-level nested array [a row/column -like setup]. It is working, but I would like to rewrite the above code as a reduce(). I was able to come up with a few versions [doing map/filter], but they were all pretty complicated, doing multiple passes for comparisons. The loop version is simple.
Any ideas how to remap the above to a "functional" version?