Simply put, a thread is a simple and independent snippet of running code. It is a container in which your tasks get executed. Before web workers, JavaScript provided just a single thread; that is, the main thread for the developers to do everything in.
This created some problems with advancements in tech. Suppose you're running a smooth CSS3 animation, and suddenly you need to do a heavy calculation on the JavaScript end for some reason. This'll make the animation sluggish if you do it on the main thread. However, if you offload it to a web worker that runs in its own thread, it will have no effect on the user experience.
Because web workers run in their own threads, they cannot have access to the following:
DOM
: It is not thread-safe to access it from web workers and the main UI scriptparent
object: Basically, this gives access to some DOM APIs that for the same reason as stated above, would be thread-unsafe to accesswindow
object: BOM (Browser Object...