What are Web Workers, and when would you use one?
Instruction: Explain the concept of Web Workers and provide a use case.
Context: This question evaluates separate worker execution, communication, lifecycle and the tradeoff between responsiveness and processing overhead.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A dedicated Web Worker runs JavaScript in a separate execution context. It is useful for substantial parsing or computation that would otherwise occupy the page's main thread. The worker cannot directly read or update the page DOM.
The page starts a worker, sends input with postMessage, and handles its result or error...