I am working through a javascript problem that asks me to:
Write a function that splits an array (first argument) into groups the length of size (second argument) an
Another version:
function chunk(arr, size) { var result = []; while (arr.length > size) { result.push(arr.splice(0, size)) } if (arr.length) result.push(arr); return result; }