es6-const-let Flashcards
What is a code block? What are some examples of a code block?
A code block is a group of code within an opening and closing curly brace, an example would be functions, loops, ect.
What does block scope mean?
The code inside of a block that is not visible outside of the block. The code is only available inside of the code block.
What is the scope of a variable declared with const or let?
They should both be block scopes.
What is the difference between let and const?
Let: works similar to be var (value can be changed)
Const: cannot be reassigned (value cannot change)
Why is it possible to .push() a new value into a const variable that points to an Array?
Const defines reference, reference cannot be reassigned but value can be changed
How should you decide on which type of declaration to use?
If the value needs to change: let, if the value doesnt need to change: const