【发布时间】:2020-10-17 00:28:57
【问题描述】:
我正在尝试在 nodejs 的异步函数中编写一个函数。这是我的示例脚本
module.exports = async function (context, req) {
var mydata = (async () => {
return "output needed"
}) ()
console.log(mydata)
}
预期输出为:output needed
我得到的是:promise{ <pending> }
有什么想法等到承诺兑现?
【问题讨论】:
-
一切看起来都是同步的。删除同步
标签: node.js promise async-await es6-promise azure-function-app