How Java Script Works Internally
I am creating this java script article series for the developers who works in backend or any other technologies but they want to learn the frontend also to become a full stack developer. Because now a days if we want to survive and grow in the market we should know both the frontend and backend. And the frontend starts with java scripts in the beginning of my carrier I knew how to write the code in java script/jQuery but I did not knew how its executes internally. So with the help of these articles I will try to explain how java script works and what are the things behind the scene. And I hope these articles will be very helpful for you and will clear all the doubts regarding the java script.
How Java Script Works Internally?
In this article we will talk about:
- How Java Script works?
- How Java Script executes?
- Is Java Script Synchronous/Asynchronous?
- Is Java Script Single Threaded/Multi Threaded.
Note:-Everything in the java script happens inside the execution context.
What is Execution Context?
Everything single activity in the java script happens inside the execution context. You can assume it like a container or engine. Let us understand how the execution context looks like and what are the components of the execution context.
Execution Context contains two component mainly
- Memory or Variable Environment.
- Code or Thread Of Execution.
Memory Or Variable Environment:- In the memory or variable environment the variable will store and functions will store in the key value pair.
Code Or Thread Of Execution:-In the code or Thread Of Execution the code will be executed line by line. So this thread of execution is just like a thread in which whole code is executed one line at a time.
Note:-Java Script is a synchronous single threaded programming language.
Single Threaded:-Single Threaded means java script can executes one thread at a time. All the lines of code in the Thread Of Execution are the threads. And in the Thread Of Execution the lines/threads will be executed one by one.
Synchronous:-Synchronous means when the thread is executing the only one thread can execute at a time during execution of one thread no another thread can do another execution in parallelly.
Note:-Please don't confuse here with AJAX(Asynchronous Java Script And XML). We will talk about the AJAX as well.
Comments
Post a Comment