Difficulty: 5/10Worker creation, Message passing, Performance optimizationCreate a worker with new Worker('worker.js'), communicate using postMessage and onmessage events.Main threadCopyworker.jsCopyScenario Questions0-2 years experience1Imagine you need to offload a heavy image‑processing loop from the UI thread. How would you set up a Web Worker to run that code and get the result back?2If you create a worker with `new Worker('worker.js')` and want to send a JSON object to it, what code would you write on both sides to exchange the message?2-5 years experience1You added a Web Worker to fetch and parse a large CSV file, but the UI still freezes intermittently. What could be causing that, and how would you debug it?Follow-up QuestionsWhat happens if the worker script fails to load?How would you handle sending large binary data efficiently?When would you choose a SharedWorker over a dedicated Worker?Suggest Improvement