es-6-const-let Flashcards

1
Q

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

A

any line of code within { } is a code block.

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

What does block scope mean?

A

It means it is only visible inside the code 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 or local 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 is mutable and const is not (cant reassign)

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

Const allows you can change the values of the property.
we can change data within inside the memory space. we only reserve that memory space (not changeble). like Home address but can change furniture.

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

If you know the value is going to change use let if not stick with const

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