es6 Const Let Flashcards
What is a code block? What are some examples of a code block?
A code block is a block of code that is ran when a conditional is met.
What does block scope mean?
The variable is only effective in the scope of the block.
What is the scope of a variable declared with const or let?
Block scope
What is the difference between let and const?
let’s value can be reassigned and const’s cannot.
Why is it possible to .push() a new value into a const variable that points to an Array?
Because it’s not directly changing the variables value.
How should you decide on which type of declaration to use?
If you’re going to change the value of a variable, use let. If you’re stating something to be almost permanent, then use const.