How JavaScript Works?

Sadiq Shah - Jan 4 '23 - - Dev Community

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.

. . . . . .
Terabox Video Player