94 Flashcards

(5 cards)

1
Q

Hoisting

A

JavaScript’s default behavior whereby the interpreter moves function declarations and variables to the top of their current scope before code execution

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

Hoisting In the Background

A

Before execution, code is scanned for variable declarations, and for each variable, a new property is created in the variable environment object

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

Which of the following are hoisted?
* function declarations
* var variables
* let and const variables
* function expressions and arrow functions

A
  • function declarations: YES
  • var variables: YES
  • let and const variables : NO
  • function expressions and arrow functions: DEPENDS if using var or let/const
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Scope of…?
* function declarations
* var variables
* let and const variables
* function expressions and arrow functions

A
  • function declarations: Block (in strict mode), Function (otherwise)
  • var variables: Function (Local)
  • let and const variables: Block
  • function expressions and arrow functions: DEPENDS if using var or let/const
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Temporal Dead Zone (TDZ)

A
  • the period of time during which the let and const declarations cannot be accessed
  • starts when the code execution enters the block which contains the let or const declaration and continues until the declaration has executed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly