The HTML Web Workers is useful in performing a computationally expensive task without interrupting the user interface.
Note: Web workers are often able to utilize multi-core CPUs more effectively.
The following is your web-worker.js file. In the below code
postMessage() method is used to post a message back to the HTML page.