Answers for "split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument)."

0

split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument).

function chunkArrayInGroups(arr, size) {
  let newArr = [];
  while (arr.length > 0) {
    newArr.push(arr.splice(0, size));
  }
  return newArr;
}
Posted by: Guest on March-21-2022

Code answers related to "split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument)."

Browse Popular Code Answers by Language