From the course: JavaScript: Async

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

What is a web worker?

What is a web worker? - JavaScript Tutorial

From the course: JavaScript: Async

What is a web worker?

- [Instructor] JavaScript includes a number of features that enable you to program asynchronously, including callbacks, promises and async/await, but all of these async processes still rely on the main browser thread to execute their code after any delay has taken place, such as a set timeout or a response to an AJAX request. The traditional asynchronous model for JavaScript simply rearranges the order in which code is executed on a single thread to avoid blocking, but features that use this model remain limited by the fact, that with a single thread, the browser can do only one thing at a time. Modern browsers support some newer additions to JavaScript that make use of additional threads. One of these newer additions is web workers. A web worker enables you to specify code that will be executed in its own thread on the processor separate from the browser thread. This enables you to make your code asynchronous and also allows…

Contents