Last active
March 12, 2021 13:22
-
-
Save miketromba/1da0643df4d1da127d3c6e8334dad87b to your computer and use it in GitHub Desktop.
chunkArray.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function chunkArray(array, size) { | |
const chunked_arr = []; | |
let index = 0; | |
while (index < array.length) { | |
chunked_arr.push(array.slice(index, size + index)); | |
index += size; | |
} | |
return chunked_arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment