DEV Community

kim-jos
kim-jos

Posted on • Edited on

3

What is the JS Execution Context?

What is the execution context in JS?

Everything in JS happens within an execution context. Imagine a big box with two sides or look at the diagram below. The left side is the memory component(variable environment) while the right side is the code component(thread of execution).

image

What does the memory component of the execution context do?

The memory component(variable environment) is where all the variables and functions are stored in key value pairs even before code is executed.

What does the code component of the execution context do?

The code component(thread of execution) is where all JS code is executed one line at a time.

Is JS a synchronous single-threaded language?

Yes.

What does single-threaded mean?

Single-threaded means that JS can only execute one thing at a time.

What does synchronous mean?

Synchronous signifies the order in which JS executes code. JS can execute the next line of code only if the current line of code has been executed.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

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

Okay