Answers for "async fetch api call"

9

async fetch api call

async function getUserAsync(name) {
  try{
    let response = await fetch(`https://api.github.com/users/${name}`);
    return await response.json();
  }catch(err){
    console.error(err);
    // Handle errors here
  }
}
Posted by: Guest on March-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language