One of the most popular and well-maintained programming languages of the 21’st century.
this article tells you all the basic components the help to run your *.js plain text file in the browser:
The Call Stack
concurrence and event loop
how your computer knows what to do with the hunk of text you wrote?
The type of compile used to do this task is called a just-in-time compiler.
|V8||Google Chrome and Node.js|
|Spider Monkey||Mozilla Firefox|
The engine comprises two major components:
Memory Heap: where the memory allocation happens.
Call Stack: this is where your code is executed
the call stack is the place where your actual code is executed, but you can't achieve that without a memory heap, heap is the place where all your object is stored.
for example variables, functions, and everything else.
The Runtime Environment
The Call Stack
the call stack is a data structure that works on a FIFO system, which means first in First out, which means the command the caller first will be the first to show the output.
console.log("1"); console.log("2"); console.log("3"); console.log("4"); console.log("5");
Concurrency and the Event Loop
What happens if you have active calls in Call Stack that take a long time to process?
You may ask - why is this a problem?
The problem is that while Call Stack has tasks to perform, the browser cannot do anything else - it is blocked. This means that the browser cannot perform, cannot use any other code, it is simply blocked. And this creates a problem.
And that is not the only problem. When your browser starts processing multiple tasks in Call Stack, we may stop responding for a long time. And many browsers take action by suggesting an error, asking you if you want to close a webpage and in the worst-case senior your browser might stop responding to your system.
more about Concurrency and the Event Loop in later articles so stay tuned.
Top comments (0)