es6-const-let Flashcards
What is a code block? What are some examples of a code block?
the area surrounded by curly braces { }. Example is a function, for, while, or if statement code block.
What does block scope mean?
it means its scope is not global and is attached and exists only inside the current block
What is the scope of a variable declared with const or let?
block-scoped
What is the difference between let and const?
unlike let, const can’t be reassigned
Why is it possible to .push() a new value into a const variable that points to an Array?
because the array itself can be changed but the const variable can’t be changed; the value of the const variable can be changed but the value itself can’t be reassigned.
How should you decide on which type of declaration to use?
whether or not you want to reassign that variable or not and if it is in a block or not; use const unless you can’t