es6 Const Let Flashcards
1
Q
What is a code block? What are some examples of a code block?
A
The code within a { };
2
Q
What does block scope mean?
A
The area within if | conditional | for loops
3
Q
What is the scope of a variable declared with const or let
A
the block that the variable is declared in
4
Q
What is the difference between let and const?
A
Const is immutable and cannot be changed,
Let can be changed
5
Q
Why is it possible to .push() a new value into a const variable that points to an Array?
A
You’re just adding to the array, not changing the array itself
6
Q
CONHow should you decide on which type of declaration to use?
A
Use const until you can’t.