Is Javascript Synchronous or Asynchronous?

Nazmul Huda
2 min readJun 17, 2021

Javascript is a kind of lightweight, interpreted, object-oriented programming language that has first-class functions and it is best known as the scripting language for web pages. Although it uses many non-browser environments as well. There’s a great misconception or confusion about javascript that Is Javascript synchronous or Asynchronous?

Well, Javascript is Synchronous, It is synchronous, single-threaded language. Because it has a single thread that’s why it can only execute one command at a time and the other commands need to wait for executing before the running command executes. And the term synchronous means one at a time. So after these conversions, we get to know that javascript only executes one command or a single block of code at a time that means it is blocking.

But What if I say Javascript has asynchronous behaviour also. Yes, I am not totally wrong because we can manipulate the behaviour of javascript by using asynchronous operations like promises, callbacks etc. It can also make AJAX calls, which means if we make an ajax call then the user can still work or get his other commands done while the request is waiting for a response. That means we can manipulate js behaviour in an asynchronous way.

It would be wrong if we say javascript is completely asynchronous. Instead, we can say Javascript is synchronous and single-threaded language with various callback mechanisms.

--

--