I have the following code, console.log is just to show what happens
function splitToChunks(array, parts) {
let result = new Array(parts).fill([]);
array.map((e,i)=> {console.log("r[",i%parts,"] gets -> ", e )|| result[i%parts].push(e)})
return result;
}
testing with arr = [0...11]
expected result would be:
[
[0, 4, 8],
[1, 5, 9],
[2, 6, 10],
[3, 7, 11],
]