Interview Question

What are web workers?

Web Workers move heavy JavaScript work off the main interface thread.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

Web Workers run JavaScript work away from the main page thread. • They help prevent heavy calculations from freezing the interface. • They communicate by sending messages. • They cannot directly change the DOM.

💡 Simple Example

<p>const worker = new Worker(&#039;worker.js&#039;);</p>

⚡ Quick Revision

Web Workers move heavy JavaScript work off the main interface thread.