ES6-Const-Let Flashcards
What is a code block? What are some examples of a code block?
A code block is a chunk of code bounded by {}
What does block scope mean?
block scope restricts the variable that is declared inside a specific block, from access by the outside 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 variable values can be updated while const variables cannot
Why is it possible to .push() a new value into a const variable that points to an Array?
You cannot set a new value to a const variable but if the const variables value is an array or object you can update the elements or properties of that const array or object
How should you decide on which type of declaration to use?
It depends on whether or not the variable you are declaring will have its values change.