📜  获取等待 - Javascript 代码示例

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

代码示例1
async function getUserAsync(name) 
{
  let response = await fetch(`https://api.github.com/users/${name}`);
  let data = await response.json()
  return data;
}

getUserAsync('yourUsernameHere')
  .then(data => console.log(data));