Variables Flashcards

Get a fucking job

1
Q

What is var?

A

A statement that declares function-scoped or globally-scoped variables, optionally initializing each to a value.

Variables declared with var are hoisted (they are processed before any code execution).

Only the variable declaration is hoisted, not its initialization.

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

What is let?

A

A statement that declares re-assignable, block-scoped local variables, optionally initializing each to a value.

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

What is const?

A

A statement that declares block-scoped local variables. The value of a constant can’t be changed through reassignment using the assignment operator, but if a constant is an object, its properties can be added, updated or removed.

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

What is the TDZ?

A

Temporal Dead Zone. A variable is said to be in the TDZ from the start of the block until code execution reaches the place where the variable is declared and initialized.

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

What is hoisting?

A

Process in which the parser/interpreter appears to move the declaration of functions, variables, classes or imports to the top of their scope, prior to the execution of the code.

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

What is nullish coalescing?

A

A logical operator (??) that returns its right-hand side operand when its left-hand side operand is null or undefined. Otherwise, it returns its left-hand side operand.

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