92 Flashcards

(7 cards)

1
Q

Scoping

A

How our program’s variables are organized and accessed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Lexical Scoping

A

the ability for a function to access variables from parent scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Scope

A

Space or environment in which a certain variable is declared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Scope of a variable

A

region of our code where a certain variable can be accessed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

3 Types of Scope

A
  1. Global Scope: variables are accessible everywhere
  2. Function (local) Scope: variables are accessible only inside function, not outside
  3. Block Scope (ES6): variables are accessible only inside block (only applies to let and const variables); IN STRICT MODE: functions are also block scoped
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Scope Chain

A

every scope always has access to all the variables from all its outer scopes: THIS is the scope chain!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Variable Lookup

A

when a variable is not in the current scope, the engine looks up in the scope chain until it finds the variable it’s looking for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly