Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

async function fetchJson

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)); 
Comment

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
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: radio button checked event jquery 
Javascript :: delegate jquery 
Javascript :: expressjs create encrypted password 
Javascript :: How to make string shorter javascript 
Javascript :: import reactdom 
Javascript :: how to clear nodemon cache 
Javascript :: using material ui icons in react 
Javascript :: calculate age based on date of birth in javascript 
Javascript :: mouse coordinates not math with canvas coordinates in js 
Javascript :: jquery get base url 
Javascript :: split sentence including special characters javascript 
Javascript :: how to scroll down to the bottom of a div using javascript 
Javascript :: slick slider before change 
Javascript :: javascript sort chars in string 
Javascript :: get query param javascript 
Javascript :: javascript format number as currency 
Javascript :: npx create next app 
Javascript :: how to do text to speech in javascript 
Javascript :: drupal twig node alias 
Javascript :: typescript prevent node modules 
Javascript :: validate name in javascript 
Javascript :: javascript get domain name from string 
Javascript :: hidden jquery 
Javascript :: nodejs put array in file 
Javascript :: index export in nodejs 
Javascript :: discord.js create unexipable invite 
Javascript :: why is the radiators in cars painted black 
Javascript :: detect keypress 
Javascript :: js replace all char in string 
Javascript :: disable default sorting in datatable 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =