Skip to content

Instantly share code, notes, and snippets.

@dan-maximov
Last active April 19, 2019 05:22
Show Gist options
  • Save dan-maximov/452c9dd027a8c7b7310f0ed6863859cb to your computer and use it in GitHub Desktop.
Save dan-maximov/452c9dd027a8c7b7310f0ed6863859cb to your computer and use it in GitHub Desktop.
chunk array
const getChunks = (arr, size) => {
const sets = [];
const chunks = arr.length / size;
let i = 0;
while (i < chunks) {
sets[i] = arr.splice(0, size);
i++;
}
return sets;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment