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
2
Q
What does block scope mean?
A
It means the variables declared within the block can’t be accessed outside of the block.
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)
4
Q
What is the difference between let and const?
A