Execution Context: (Code) Execution Phase

As you recall from the previous part, I mentioned that there are two phases that take place in the Execution Context.

The first is Creation Phase, the second is Execution Phase.

This part is more obvious than the previous one. Let's start with the reminder that when creating the Execution Context thanks to the JavaScript engine we get:

  • Global Object
  • Special variable: this
  • Outer Environment

Then memory is reserved for all variables and functions. When this happens, the Execution Phase begins.

As the name of the phase suggests our code is read line by line, then it is compiled and enforced.

And thats basically all that happens in Execution Phase, no tricks or complicated definitions.

Finally - a short test. What do you think will be the output of all console.log methods in the JavaScript code bellow?


var a = "Hello";
var b;

function hello() {
  console.log("I'm inside b function");



Next Post

I will talk about what does it mean that JavaScript is single threaded and synchronous language