9 Best Supplements You Need on a Keto Diet

Shifting from a high-carb to a low-carb lifestyle can affect your body. Supplementation eases keto flu symptoms, boosts your performance, and helps your body function at its best. When done…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




What does it mean by Javascript is single threaded language

If you have been using Javascript for a while then you may come across the phrase that it’s a single threaded language.

What does that means?

Javascript engine runs on a V8 engine that has a memory heap and a call stack.

JS is a single threaded which means only one statement is executed at a time.

Before we dive into what it means by it runs on single thread. I would want to first go over the terminology that will help you in understanding.

To put it in example, you are calling someone and you’re waiting for them to pick up so that you can talk to them. You’re not doing any other thing until they pick up the phone.

You fulfill the request sequentially.

So, what happens under the call stack?

The call stack job is to fill in the instructions and pop an instruction as it gets executed.

Javascript is a single threaded language that can be non-blocking. Single threaded means it has only one call stack. Whatever is on the top of the call stack is run first.

In the above program, functions are run sequentially.

What if we have a function that is require to do heavy lifting. Should we let the user wait till that process is over?

Consider the above example, what if our second function has to loop through huge numbers. Does this means three() has to wait till…

Add a comment

Related posts:

La Arquitectura como base

Cuando estaba en el secundario, la profesora de arte del colegio nos dio una tarea para hacer. Esta tarea consistía en dibujar una perspectiva sin saber técnicamente como hacerla. Teníamos que salir…

How Often You Think About Something Says a Lot About You

What matters in your life isn't just what you talk about. What matters in your life is also what you think when you're alone.