ES6 const and let Flashcards
What is a code block? What are some examples of a code block?
code that runs within a function. Loops, functions, if, etc.
Any collection of curly braces
What does block scope mean?
variables within a function - denotated by curly braces
What is the scope of a variable declared with const or let?
block scoped
What is the difference between let and const?
const keyword values can’t be reassigned.
Let can be reassigned
Why is it possible to .push() a new value into a const variable that points to an Array?
The value in which the const variable references is changeable
How should you decide on which type of declaration to use?
If a variable should be constant use const and if a variable needs to be mutable use let.