async function getInfoByName(name) {
return await search.getInfo(name);
}
console.log(getInfoByName('title'));
它返回Promise { <Pending> }
,如何返回我需要的值?
最佳答案
您可以使用 promise then callback .
getInfoByName('title').then((result) => {
console.log(result))
}
关于javascript - 异步和等待nodejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46683615/