Is Javascript Single-Threaded?

Yes!! Javascript is a single-threaded language. This means it has one call stack and one memory heap. As expected, it executes code in order and must finish executing a piece of code before moving onto the next.

It’s synchronous, but at times that can be harmful. For example, if a function takes a while to execute or has to wait on something, it freezes everything up in the meanwhile.

Then How Is It Asynchronous?

Open your console and type window then press enter. You'll see everything the Web API has to offer.

This includes things like ajax calls, event listeners, the fetch API, and setTimeout. Javascript uses low-level programming languages like C++ to perform these behind the scenes.

To Explore More: http://latentflip.com/loupe

--

--

Developer with 3 yrs of industrial experience in developing scalable web applications.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhay Jain

Developer with 3 yrs of industrial experience in developing scalable web applications.