Section 2: Execution Context and Lexical Environments Flashcards
What is a Syntax Parser
- A program - Read the code - Determines what it does Check if grammar is valid
What is a Lexical Environment
Where something sits physically in the code Were code is written is important
In this code, where is sitting “var a” lexically
function hello() {
var a = “hello world”;
}
inside the function
What is an Execution Context
A wrapper to manage the code that is running. The section of code that is running. There are lots of lexical environments. Which one is currently running is managed via execution contexts. It can contain things beyond what you’ve written in your code
What is a Name/Value Pair?
Is a name which maps to a unique value.
In a name/value pair, can we define more than one name/value pair?
Yes
In a name/value pair, a name, can hold more than one value in any given context?
No, just one value
in any particular execution context, a name can only exist and be defined with one value?
Yes
in any particular execution context, a name/value pair, can hold more name/value pairs?
Yes
what is an An Object in JS?
Is a collection of name/value pairs(and that value can be a collection of more name/value pairs).
Whenever code is run in JS, where do we say it´s running?
Inside an execution context
What is the base execution context?
the global execution context It´s accesible everywhere to everything in the code
A global execution context creates what things?
A global object(window) A special variable called this
at the global level, what object and keyword are equal?
the window object, and “this”
When we mean Global in JS we mean, what?
Not inside a function
The execution context is created in how many phases?
2 phases