async/await是什么
时间: 2023-08-27 18:14:15 浏览: 105
Async/Await替代Promise的6个理由
async/await是用于处理异步操作的一种语法糖。async用于申明一个函数是异步的,而await用于等待一个异步方法执行完成。async函数返回一个Promise对象,可以使用then()方法进行链式调用,而await关键字则可以暂停async函数的执行,等待Promise对象的结果返回。async/await的使用可以使异步代码更加简洁易读,避免了回调地狱的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [什么是async/await?](https://blog.csdn.net/qq_41761591/article/details/102534763)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [async与await详解](https://blog.csdn.net/qq_45662523/article/details/126683975)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文