0
0
Javascriptprogramming~5 mins

Function execution context in Javascript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a function execution context in JavaScript?
It is the environment where a function runs. It stores information like variables, parameters, and the value of this while the function executes.
Click to reveal answer
intermediate
What are the three main parts of a function execution context?
1. Variable Environment (stores variables and parameters)<br>2. Scope Chain (links to outer contexts)<br>3. this value (context of the function call)
Click to reveal answer
beginner
When is a function execution context created?
It is created every time a function is called, before the function code runs, and destroyed after the function finishes.
Click to reveal answer
intermediate
How does the scope chain affect variable access inside a function?
The scope chain lets the function access variables from its own context and from outer contexts, like the global scope or parent functions.
Click to reveal answer
advanced
What is the value of this inside a function execution context?
It depends on how the function is called. For example, in a regular function call, this is undefined in strict mode or the global object otherwise. In methods, this is the object owning the method.
Click to reveal answer
When is a new function execution context created in JavaScript?
AEvery time a function is called
BOnly once when the function is defined
CWhen the script loads
DWhen the browser refreshes
Which part of the function execution context stores the function's parameters and local variables?
AVariable Environment
BScope Chain
C<code>this</code> value
DCall Stack
What does the scope chain in a function execution context do?
ADefines the value of <code>this</code>
BStores the function's code
CLinks to outer variable environments for variable lookup
DManages asynchronous calls
What is the value of this inside a regular function call in strict mode?
AThe global object
BThe object owning the function
CThe function itself
DUndefined
What happens to a function execution context after the function finishes running?
AIt stays in memory forever
BIt is destroyed and removed from the call stack
CIt becomes global context
DIt pauses until called again
Explain what a function execution context is and what it contains.
Think about what the function needs to remember while it runs.
You got /4 concepts.
    Describe how the scope chain works inside a function execution context.
    Imagine looking for a variable inside nested boxes.
    You got /3 concepts.