Offload CPU-intensive work to a Web Worker and explain communication.

This tests main-thread blocking and worker messaging. A strong answer covers: new Worker(url), moving logic to a worker file, sending data via postMessage(), and receiving results via onmessage. A red flag is suggesting DOM use or shared memory from workers.
This tests main-thread blocking and the browser event loop. A strong answer covers four things: instantiate a dedicated worker with new Worker(url), move the heavy calculation into the worker script, send cloned data via postMessage() from either side, and receive results via the onmessage handler. A red flag is claiming workers can touch the DOM, use window methods, share objects by reference rather than structured clone, or suggest that setTimeout achieves true parallelism.
Read the original → developer.mozilla.org
- #web workers
- #javascript
- #browser apis
- #concurrency
- #performance
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.