ES6 Flashcards
What is a code block? What are some examples of a code block?
a function code block. Something that is inside of curly brace
What does block scope mean?
means where the code can look
What is the scope of a variable declared with const or let?
block or function level
What is the difference between let and const?
const is setting a variable that never changes and let allows you to change the variable.
Why is it possible to .push() a new value into a const variable that points to an Array?
because you’re adding a value not changing the original value.
How should you decide on which type of declaration to use?
What is the syntax for writing a template literal?
back ticks are a major part of template literals.
What is “string interpolation”?
The JavaScript engine automatically replace these variables and expressions with their values.
What is destructuring, conceptually?
it’s taking specific properties and assigning them to a specific variable.
What is the syntax for object destructuring?
const{ variable , variable, variable } = object
What is the syntax for array destructuring?
const [variable, variable, variable] = object name.
How can you tell the difference between destructuring and creating object/array literals?
if we are creating the variable is on the right side. if it is on the right side we are evaluating the variable/destructuring.
What is the syntax for defining an arrow function?
variable declaration = (parameters(optional)) => { statements }
When an arrow function’s body is left without curly braces, what changes in its functionality?
How is the value of this determined within an arrow function?