I have an array for example:
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
I would like to turn it into the following:
[ [1,2,3,4,5,6],
[7,8,9,10,11,12],
[13,14,15,16,17,18] ]
Basically I need to group every 6 elements, and the arrays of those should be the elements of the 2D array.
I'm not explaining it very well, but the example should be clear.
I've been playing around with some for loops but I could never get the right output. Any help would be appreciated.