Split Arrary into chunk

January 12, 2024

Util Functions

Split Arrary into chunk

Thuta Sann

Thuta Sann

A Util Function to split huge array into array chunks


Share This Snippet To :

Split Arrary into chunk

In this snippet, I would demonstrate a Util Function to split huge array into array chunks.

const chunkArray = (array, chunkSize) => { const chunks = []; for (let i = 0; i < array.length; i += chunkSize) { chunks.push(array.slice(i, i + chunkSize)); } return chunks; }

Cookie

I baked some cookies that you have to accept, if you want to enjoy my portfolio.
In order to gather information and make improvements, I should use some third-party cookies too, Can I?