async await是ES7语法嘛
时间: 2023-10-17 09:35:43 浏览: 90
是的,async和await是ES7中新增的语法。它们用来改进异步代码的编写方式,是Promise的升级版。 async函数中可以包含await表达式,当执行到await表达式时,函数会暂停执行,直到触发的异步操作完成。注意,await只能在async函数中使用,否则会导致语法错误。 使用async修饰的函数会返回一个Promise对象,可以通过.then()方法获取异步操作的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [async-await语法](https://blog.csdn.net/m0_57262819/article/details/124545456)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [ES7之async,await](https://blog.csdn.net/qq_39682399/article/details/108649138)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文