In your web application, the Web Workers specification specifies an API for spawning background scripts. Web Workers allow you to run long-running scripts to conduct computationally heavy activities without obstructing the user interface or other scripts that manage user interactions.
Web Workers allows you to conduct a script operation in a background thread separate from the web application's main execution thread. The benefit is that time-consuming processing can be done in a separate thread, freeing up the main thread (typically the UI) to run without being slowed down.
Extended-running scripts are not interrupted by scripts that respond to clicks or other user events, and long tasks can be completed without yielding in order to maintain the page responsive.