FrontEnd.ro logo
async-await
async function fetchEmail(githubUsername) {
  try {
    let response = await fetch(`https://api.github.com/users/${githubUsername}`);
    let profile = await response.json();
    return profile.email;
  } catch (reason) {
    console.log(`Couldn't fetch username`, reason);
    throw reason;
  }
}