ES6 Flashcards
Features of ES6
- arrow functions
- let/const
- template literals
- Classes
- destructuring
- Async & await
Let/Const scope
Block scope = local scope
Arrow functions allows a ____ for writing function expressions.
short syntax
Arrow functions do not have their own ___. They are not well suited for defining object methods.
this
Arrow functions are not ___. They must be defined before they are used.
hoisted
You can only omit the ___ keyword and the curly brackets if the function is a single statement. Because of this, it might be a good habit to always keep them:
return
JavaScript Classes are __ for JavaScript Objects.
templates
Make a class Car with name property
When you have a class, you can use the class to create objects:
For example create myCar2 using class Car
let myCar2 = new Car(“Audi”, 2019);
___ are a cleaner and more beautiful way to play with strings.
Template literals
They get rid of the need for a lot of + signs to concat strings.
Template literals
Destructuring Objects: get firstName and lastName using it
let information = { firstName: 'Dylan', lastName: 'Israel'};
let { firstName, lastName } = information;
Destructuring Arrays
Point to first element of the array with firstname
['Dylan', 'Israel'];
let [firstName] = ['Dylan', 'Israel'];