LFZ ES6 Quiz Flashcards
What is a code block? What are some examples of a code block?
Anything between {}. An example would be the {} after an if expression
What does block scope mean?
Anything inside of a code block
What is the scope of a variable declared with const or let?
The code block it is declared in
What is the difference between let and const?
you can redeclare let, but you cant redeclare const
Why is it possible to .push() a new value into a const variable that points to an Array?
the values of the array are mutable
What is the syntax for writing a template literal?
using the backtick `
What is “string interpolation”?
string formatting
What is destructuring, conceptually?
Taking properties from objects and assigning them to variables
What is the syntax for Object destructuring?
const/let {property: variable name, etc} = object
What is the syntax for Array destructuring?
const/let [variable name, etc] = array
How can you tell the difference between destructuring and creating Object/Array literals?
objects have {} and arrays have []
What is the syntax for defining an arrow function?
let/const verName = functionParameters => (return expression)
When an arrow function’s body is left without curly braces, what changes in its functionality?
it will implicitly return with out curly braces
What are the three states a Promise can be in?
pending, fulfilled, and rejected
How do you handle the fulfillment of a Promise?
with the then method
How do you handle the rejection of a Promise?
with the catch method
What is “syntactic sugar”?
syntax within a programming language that is designed to make things easier to read or to express
What is the typeof an ES6 class?
Function
Describe ES6 class syntax.
class className { constructor(propertyName) {property assignment} customMethodName(){Method function}}
How are ES Modules different from CommonJS modules?
ES Modules use Import and export statements, while CommonJS uses require.
What kind of modules can Webpack support?
ES6, CommonJS, AMD