es6-const-let Flashcards
What is a code block? What are some examples of a code block?
The code block is the code written inside a pair of curly braces { }. Examples would be the code block within the curly braces { } of an if or for statement.
What does block scope mean?
The variables declared inside the block, can only be accessed inside that block.
What is the scope of a variable declared with const or let?
Block scope.
What is the difference between let and const?
Let can be reassigned and const can’t.
Why is it possible to .push( ) a new value into a const variable that points to an Array?
You can change the value, but the identifier cannot be reassigned.
How should you decide on which type of declaration to use?
Use const unless you can’t.