Skip to main content

Practice ยท 2 of 3

Read/Write Batcher

A DOM interaction is a list of ops: { op: "read" | "write", el, value? } (reads return the element's current height, writes set it). Write simulate(ops) executing with correct batching: process ALL reads first (collecting heights), then ALL writes. Return the array of read heights in order. A naive interleaved implementation causes N forced layouts; yours must cause at most 2.

Difficulty: intermediate

Back to lesson: Practice: Render Pipeline โ€” Practice