promise、async和await执行顺序
2019-03-23 14:33
579 查看
console.log(1) fn() var pro = new Promise(function (resolve, reject) { console.log(3) resolve() console.log(4) setTimeout(function () { console.log(8) }, 0) }) pro.then(data => { console.log(7) }) setTimeout(function () { console.log(9) }, 0) console.log(5) async function fn () { console.log(2) await pro console.log(6) } // 详细了解同步异步,微队列和宏队列之间的关系!
相关文章推荐
- 关于async/await、promise和setTimeout执行顺序
- promise、async、await之执行顺序
- 8张图让你一步步看清 async/await 和 promise 的执行顺序
- 使用Promise和async-await实现的一个异步遍历+同步执行任务的实例
- 用async-await实现类似Promise.all()的执行效果
- setTimeout async promise执行顺序总结
- ReactNative踩坑日志——使用async/await语法解决网络请求的异步导致的指令执行顺序错乱问题
- 错误的理解引起的bug async await 执行顺序
- Promise,Async,await简介
- async await promise
- 详解koa2学习中使用 async 、await、promise解决异步的问题
- node Promise (async/await)
- 重构:从Promise到Async/Await
- Promise和Async/Await用法整理
- 基于Promise的async和await的区别
- Promise 异步函数顺序执行
- 前端的异步解决方案之Promise和Await-Async
- 一览 promise、async/await
- Promise的顺序执行
- Async/Await替代Promise的6个理由