es6 const let Flashcards
1
Q
What is a code block? What are some examples of a code block?
A
Code that is inside a single scope. Anything inside braces.
2
Q
What does block scope mean?
A
If defined in the block the variable is treated as local only inside the block
3
Q
What is the scope of a variable declared with const or let?
A
Block scope
4
Q
What is the difference between let and const?
A
let can be reassigned but const cannot
5
Q
Why is it possible to .push() a new value into a const variable that points to an Array?
A
It is not being reassigned. It is being mutated. It is not pointing somewhere else.
6
Q
How should you decide on which type of declaration to use?
A
Based on whether you plan on reassigning it.