1. Promise Basic concept
2. State diagrams
3. FAQ (Interview Questions)
4. Promise execution time (interview questions)
A) Will the resolve code be executed?
I.,
Ii. Execution Results:
iii.
1. Resolve will place promise. then in the microtask queue when there is no Error, and the microtask queue will be executed when all macro tasks are completed.
2. When there is an Error, the code behind the Error will not be executed, but the result of the Promise is still a pity
B) When the Promise encounters setTimeout
i.
Ii. Execution Results:
iii.
1. Execution sequence: 1 => 2 => 4 (macro task ends) =>3 (micro task ends)
5. Async/await with Promise
A) To sum up: an await is a Promise. If it is not a Promise, and if it is not, then an await will be invalid.
I. Turn the regular callback into the Promise method
ii.
Iii. Convert promises to async/await
Here is a front-end interview information to give you, there is a need to collect and private letter can be free to get oh.
In this paper, from the WEB zoroastrianism light roof (https://web.xingruanedu.com)