Recall & Review
beginner
What is the Global Execution Context in JavaScript?
It is the default environment where JavaScript code runs first. It creates a global object and sets up the 'this' keyword to refer to that global object.
Click to reveal answer
beginner
What two main phases happen inside the Global Execution Context?
1. Creation phase: JavaScript sets up memory for variables and functions.<br>2. Execution phase: JavaScript runs the code line by line.
Click to reveal answer
beginner
In the Global Execution Context, what does the 'this' keyword refer to?
It refers to the global object, which is 'window' in browsers and 'global' in Node.js.
Click to reveal answer
intermediate
What happens to variables declared with 'var' in the Global Execution Context during the creation phase?
They are hoisted and initialized with 'undefined' before the code runs.
Click to reveal answer
intermediate
How are functions treated differently from variables in the Global Execution Context creation phase?
Functions are hoisted and fully initialized, so they can be called before their declaration in the code.
Click to reveal answer
What is created first when JavaScript runs in the Global Execution Context?
✗ Incorrect
The global object and 'this' keyword are set up first during the creation phase of the Global Execution Context.
During the creation phase, what value do 'var' variables get assigned?
✗ Incorrect
'var' variables are hoisted and initialized with 'undefined' before code execution.
What does the 'this' keyword refer to in the Global Execution Context in a browser?
✗ Incorrect
In the global context in browsers, 'this' refers to the global object called 'window'.
Which phase of the Global Execution Context runs the code line by line?
✗ Incorrect
The execution phase runs the code line by line after the creation phase sets up memory.
Can functions be called before they are declared in the Global Execution Context?
✗ Incorrect
Functions are hoisted and fully initialized during the creation phase, so they can be called before their declaration.
Explain what happens during the creation phase of the Global Execution Context.
Think about what JavaScript prepares before running your code.
You got /4 concepts.
Describe the role of the 'this' keyword in the Global Execution Context.
Consider what 'this' points to when you are not inside any function.
You got /4 concepts.