ES6-Const-Let Flashcards

1
Q

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

A

A code block is a chunk of code bounded by {}

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

What does block scope mean?

A

block scope restricts the variable that is declared inside a specific block, from access by the outside of the 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 variable values can be updated while const variables cannot

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 cannot set a new value to a const variable but if the const variables value is an array or object you can update the elements or properties of that const array or object

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

It depends on whether or not the variable you are declaring will have its values change.

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