JS ES6 Flashcards
variables defined with const and let are ____ scoped
block scoped.
name some characteristics of a variable declared using const
value cant change. except for data types such as an array or object
name some characteristics of a variable declared using let
you can change the value kind of like var
what does block scope mean?
it is a code block with curley braces. let and const are its own scope
In the file we can push a new value to an array defined using the const variable. How does that work?
you can change information inside the array but as long as the array is still the same array then the const variable is still the same
What are some things that var can do that const and let cant?
var can hoist
If var can be used virtually anywhere, why would we switch?
because we know where values need to exist and where they dont
What is the syntax in writing a template literal?
back tick then dollar sign inside then value inside the curley braces
What is string interpolation
the process of evaluating a string literal containing one or more placeholders
When was the destructuring introduced?
in 2015 when ES6 was introduced (ES2015)
Why could the running commas technique of destructuring an array be a bad idea?
because of human error
How can you easily tell the difference between destructuring and creating array/object literals
if the brackets are on the left side then its destructuring
Why was it only set timeout the only ones changed to arrow function?
it is executed as if it was in the window scope
When arrow functions code block is left without curley braces, what would change?
it would return the value without the keyword return. Known as implicit return
In what situation would you possibly use an arrow function?
for oops without having to use this.