If your Array is too large for certain activities (e.g. sending requests to an API that has rate limits), your best choice is to split your array into multiple parts by "chunking" or "batching" the Array's data.
This code snippet is an easy way to do that, I use it all the time.
function createBatchedArray(data, chunkSize) {
const result = []
for(let i=0; i<data.length; i+=chunkSize) {
let chunk = data.slice(i, i+chunkSize)
result.push(chunk)
}
return result
}
// Example Usage
// const data = [1,2,3,4,5,6]
// let batchedArray = createBatchedArray(data, 3)
