DEV Community

Abdusanadzoda Abdulaziz
Abdusanadzoda Abdulaziz

Posted on

2 1

How JavaScript Works πŸ”₯& Execution Context

Do you know how JavaScript works and how the code is executed ?

Is JavaScript Synchronous or Asynchronous ?

Is JavaScript Single Threaded or Multy Threaded ?

If you are not familiriar with this so dont worry just keep reading.
So before going further just remember that "Everything in JavaScript happens inside an Execution Context!". You can asume this context as big box or a container in which whole JavaScript code is executed.

So lets divide this box or container in two parts left part will be Memory where all variables will be stored ad key valye pairs
ex: key:value;
And there is also another name for this Memory component which called Varibale Envirement.

The Second container is Code component , so this is the container where the code is executed line by line at the time.And people also call it Thread of Execution.

JavaScript Single Threaded or Multy Threaded

So when we say Single Threaded it means that JavaScript can only execute one line in a time.
And when we say Synchronous and Single Threaded that means that JavaScript can only execute one command in a time and in a specific order.Means that it can only go down if the current line has finished executing.

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay