Skip to content
On this page

chunk

For a given sequence, divide it into chunks of a given size and group them into arrays.

Example

chunk([1, 2, 3, 4, 5], 3) // => [[1, 2, 3], [4, 5]]

Playground

const { chunk } = require('rhodash')
chunk([1, 2, 3, 4, 5], 3) // => [[1, 2, 3], [4, 5]]