es6-const-let Flashcards

1
Q

What is a code block? What are some examples of a code block?

A

The code block is the code written inside a pair of curly braces { }. Examples would be the code block within the curly braces { } of an if or for statement.

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

What does block scope mean?

A

The variables declared inside the block, can only be accessed inside that block.

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

What is the scope of a variable declared with const or let?

A

Block scope.

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

What is the difference between let and const?

A

Let can be reassigned and const can’t.

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

Why is it possible to .push( ) a new value into a const variable that points to an Array?

A

You can change the value, but the identifier cannot be reassigned.

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

How should you decide on which type of declaration to use?

A

Use const unless you can’t.

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