JavaScript

Parallel programming in JavaScript using Web Workers

Uday Hiwarale
JsPoint
16 min readMar 31, 2018

--

JavaScript is one of the most popular programming languages of all. It is the language of the web browser. Another reason why JavaScript has become so popular is the adoption of Node.js on the server-side.

Even though JavaScript is one of the most beloved languages, it also disliked by some programmers. One reason is that JavaScript is a single threaded language. It is horrible when it comes to non-blocking operations.

Whenever you do something in JavaScript (for example, inserting text inside a DOM element), the whole web page freezes and become unresponsive.

We usually don’t notice, because modern browsers are so fast. But throughout the lifecycle of a web page, this difference can become quite noticeable.

Single-threaded languages perform only one computation at a time.

This means when your browser is running a script, all other operations (like DOM manipulation, animation, drawing, deferred executions and other operations that happens on the main thread) will come to a halt.

The browser simply won’t be responsive until that script execution is finished.

--

--