Apia saysWeb Workers run JavaScript on a background thread, communicating via postMessage.
A new Worker("worker.js") runs heavy computation off the main thread so the UI never freezes. Talk via postMessage / onmessage; workers can't touch the DOM. For zero-copy large data, use transferable objects (ArrayBuffers). Ideal for parsing, image processing, and crunching big datasets.
Power-ups you unlock
new Worker(file) runs off the main thread
postMessage/onmessage to communicate
No DOM access inside a worker
Transferables move big buffers without copying
Legacy Larry attacks — common mistakes
Touching the DOM from a worker
Copying huge data each message (use transfer)
Spawning workers for trivial work
Boss battleSketch offloading a heavy sum to a worker and posting the result back.