Skip to main content

Practice · 2 of 2

Chunked Processing

CHALLENGE
Difficulty: intermediate+25 XP

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.

Back to lesson: Practice: Event Loop — Practice