DEV Community

Cover image for How JavaScript Works?
Sadiq Shah
Sadiq Shah

Posted on

How JavaScript Works?

Working on the JavaScript is good but should also know the execution of the JavaScript.

Image description

So let discussed How JavaScript works?

  • JavaScript works on browser with the help of execution context means the execution context is the box where your all java scripts are render.

But there are two components

  • Memory Component (Variable Environment)
  • Code Component (Thread of Execution)

memory and code are linked together because code are stored into memory then execute.

Memory Component:

It is stored all variable and function as key paired value.
Example:
{
a = "sadiq"
function : sum(n,a)
}

Code Component:

In code component your all code render line by line or run 1 line at a time and also know as thread of execution.

JavaScript is synchronous single threading language.

Single Threading : Run one line of code at a time.
Synchronous Single Threading : Run one line of code at a time with

That Why JavaScript know as Synchronous Scripting Language .
specific order.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay