1. Let const vs. var
var
There’s a variable promotion,let
andconst
No variable promotionlet
Const is a constantconst
When you assign an object or array, the value of the object or array can be changed,const
Pointers are guaranteed to stay the same (values are not guaranteed to stay the same)let const
Variables are block-level scopeslet const
Variables cannot be repeatedlet const
It creates a temporary dead zone
2. Elaborate on promises
-
Because traditional asynchrony results by going back to a function, the promise was invented to address the callback hell that leads to bad code readability and maintenance costs
-
We promise we can make a promise. We promise we can make a promise. We promise we can make a promise.
-
In the promise,the prototype method then catch catch does not have all errors. Then performs state changes and then returns a new promise. Then can also perform the next PRMISE task. Support. Then performs multiple asynchronous tasks through chain calls
-
The new Promise function is executed synchronously. The then function is executed asynchronously
-
Static methods on Promise: All Race resolve Reject, etc
all
Processing concurrent business, all successful execution thenrace
One of the multiple promises successfully implements thenresolve
Changes the state to completedreject
Change the status to rejected
3. The ones that promise are asynchronous and the ones that promise are synchronous
The new Promise function is synchronization
The.then. catch function is asynchronous
4. How to solve the problem of poor readability of callback hell code
promise
5. Talk about your understanding of Async aWIat
1: Async function returns the value proMIE instance
2: await can only be used in async
Awati: Async awati, a awati program
4: Await is followed by a Promise instance
– async returns —-> await return value return
-new Promise —–> await return value resolve argument
-then returns the promise —-> await return of the function in then
6. Talk about the function of class
Is a new class type in ES6
-
Objects can be instantiated
-
Extends inheritance
-
Constructor when the class class is executed; Trigger constructor dog paw maple
-
Super triggers the constructor in the parent class
-
The static keyword can define static properties and static methods of a class
7. How do you use super in class
- Triggers the parent class’s constructor
- Call a static method of the parent class in a subclass
8. What does the ES6 object extension have
-
Deconstruction assignment
-
Short for object property
-
Extended operator
9. What are the features of the arrow function
-
Change the anonymous function to the arrow function
-
No this uses this from the previous layer
-
No arguemets use rest arguments instead
10. What is the evolution of asynchronous programming languages?
Callback functions --> promise -->generator ---->async await