Skip to main content

Practice ยท 2 of 2

Chunked Processing

Write async function processChunks(items, handler, chunkSize) that processes items in groups of chunkSize: call await handler(batch) for each batch, and between batches await one macrotask tick (await new Promise((r) => setTimeout(r, 0))) so the browser can paint. RETURN an array of every handler result in order.

Difficulty: intermediate

Back to lesson: Practice: Event Loop โ€” Practice