DEV Community

Discussion on: Array Chunking

Collapse
 
peralmq profile image
Pelle Almquist

Or even shorter 🤣

const chunk = ([...arr], n) => [...Array(Math.ceil(arr.length) / n)].map(_ => arr.splice(0, n))