📜  javascript async await 返回未定义 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:32.083000             🧑  作者: Mango

代码示例1
async function getLikes() {
  const likes = await db.get('myLikes'); // this db method returns a Promise
  // ...
  return likes; // will return a Promise resolving likes from db or an error if there is one
}

async function logLikes() {
  const result = await getLikes();
  console.log(result);
}