JSFiddle - React, Tailwind, and code Playground
by podgorniy
JavaScript
function moveIntoArrays(original, arraysNumber) {
var res;
var i;
res = [];
for (i = 0; i < arraysNumber; i += 1){
res.push([]);
}
for (i = 0; i < original.length; i += 1){
res[i % arraysNumber].push(original[i]);
}
return res;
}
// Example of usage
moveIntoArrays(document.links, 3);