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'];
____ allow you to omit the key in the object if the name of the key and value are the same.
object literal
let firstName = 'Dylan';
// avoid key this is an example of:
let information = { firstName };
Object literal
So, in the example above, we wanted to add the property of firstName in our information object. The firstName variable is another variable with the same name. We omit the key and just pass the name of the variable, and it will create the property and assign value itself.
, which creates a loop that iterates over iterable objects like String, Array, NodeList objects,
for .. of
let str = 'hello';
Please use the new loop
for (let char of str) { console.log(char);}
// "h"// "e"// "l"// "l"// "o"
Name of this functionality

Spread operator
The code above demonstrates one of the many cool implementations of using the spread operator. Here we are combining two arrays by putting them in a new array with three dots (…) in front of the name of the array.
___ helps us handle function parameters in a better way by allowing us to represent the variable number of the function parameters as an array.
rest operator
Here, we are calling the same function with a different number of parameters, and the ____ operator is handling that perfectly for us.

rest operator
Using the ___ method, we can find out if any string contains a particular character or a substring. In this lesson, you will learn in detail about the practical use-cases of this function.
includes
We all know how important it is to have modular code, especially if you are working on large-scale applications. With ___ and ___ statements in JavaScript, it has become extremely easy and clean to declare and use modules.
import and export


