ES6 CONST LET Flashcards

1
Q

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

A

Code block is the code inside the curly brace, this is where values are given to variables

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 is whatever is inside 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, var function

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

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

A

You can modify the variable, but can not assign the variable a new value
Because it’s still within its code-block

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

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

A

If the variable’s value is going to change use let
If the variables’ value is going to remain constant use const

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

What is the difference between let and const?

A

Let are not inside code-block and const is
Let variables can be changed at any time whereas constants can not be reassigned

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