ES6 Flashcards

1
Q

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

A

It is usually denoted by a set of curly braces.
If it has statements = code block
If it has key-value = object

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 the variables declared within the block can’t be accessed 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?
What is the scope of a variable declared with var?

A

block scope
which means the variable only lives inside the block
global or function scope (depending on where the variable was declared using var)

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly