Synchronous -: In synchronous operations, tasks are performed once and only when one is completed, the following is unblocked.
Single-Threaded -: Single-threaded processes contain the execution of instructions in a single sequence. In other words, one command is processed at a time.
GEC cannot be more than one because only one global environment is possible for JS code execution as the JS engine is single-threaded.
Functional Execution Context:- It is defined as the context created by the JS engine whenever it finds any function call, it is created inside GEC in the thread of execution. Each function has its own execution context. It can be more than one.
Let’s understand with an example:-
i) Memory creation phase
ii)Code execution phase
In the memory creation phase, we are allocating variables and functions in global memory space, we allocate these variables with undefined and in the case of a function, we will place all code of function as it is.
Now, when the process goes to the second phase i.e code execution phase, it will execute code one line at a time. So generally, the variable value is assigned to it but in the case of a function, something different happens.
Whenever the function is invoked new execution context is created(function execution context) inside the thread of execution and then again the same process takes place i.e creating the memory phase then the code execution phase and so on.
Now when the code execution executes the return statement it takes back control to where the function is invoked, and after that, if any other function is present same process takes place.