Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardReactworker threadsSingle-choice MCQ

You move a CPU-bound parser to a Web Worker so the main thread stays responsive. A large ArrayBuffer is passed with the transfer list: worker.postMessage(buf, [buf]). What happens to `buf` on the main thread, and why is this faster than a plain copy?

const buf = new ArrayBuffer(50_000_000); worker.postMessage(buf, [buf]); console.log(buf.byteLength); // ?