es6 Const Let Flashcards

1
Q

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

A

The code within a { };

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

What does block scope mean?

A

The area within if | conditional | for loops

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

the block that the variable is declared in

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

Const is immutable and cannot be changed,
Let can be changed

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’re just adding to the array, not changing the array itself

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

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

A

Use const until you can’t.

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