ES6 CONST LET Flashcards
What is a code block? What are some examples of a code block?
Code block is the code inside the curly brace, this is where values are given to variables
What does block scope mean?
Block scope is whatever is inside the block
What is the scope of a variable declared with const or let?
block, var function
Why is it possible to .push() a new value into a const variable that points to an Array?
You can modify the variable, but can not assign the variable a new value
Because it’s still within its code-block
How should you decide on which type of declaration to use?
If the variable’s value is going to change use let
If the variables’ value is going to remain constant use const
What is the difference between let and const?
Let are not inside code-block and const is
Let variables can be changed at any time whereas constants can not be reassigned