Web/07-JavaScript进阶/Promise的一些题目.md
2021-05-18 14:53:39 +08:00

20 lines
265 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Promise 的执行顺序
题目 1
```js
const p = new Promise((resolve, reject) => {
console.log(1);
});
console.log(2);
```
打印结果
```
1
2
```
我们需要注意的是Promise里的代码整体其实是同步任务会立即执行