function arrayChunk (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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter