且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么需要使用await关键字来调用异步方法

更新时间:2022-06-20 21:40:40

标记为异步的函数始终返回Promise

Functions marked as async always return a Promise

来自 https://developer.mozilla. org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function

异步函数是通过事件循环异步操作的函数,该事件使用隐式Promise返回其结果.

An asynchronous function is a function which operates asynchronously via the event loop, using an implicit Promise to return its result.