async function demoGithubUser() {

  //let name = prompt("Enter a name?", "Vony");
  //let done = false;  
  while (true) {
    let name = prompt("Enter a name?", "Vony");
    try {
      let user = await loadJson(`https://api.github.com/users/${name}`);
      console.log(`Full name: ${user.name}.`);
      await new Promise(resolve => setTimeout(resolve, 1000));
      return;
    } catch (err) {
      if (err instanceof HttpError && err.response.status == 404) {
        alert("No such user, please reenter.");
        //return demoGithubUser(); // n-am stiut cum sa fac :(
      } else {
        console.log(`error: `, err);
        throw err;
      }
    };
  }
}
// Ask for a user name until github returns a valid user
Ask for a user name until github returns a valid user
Ask for a user name until github returns a valid user
async function demoGithubUser() {
  while (true) {
    let name = prompt("Enter a name?", "Vony");
    try {
      let user = await loadJson(`https://api.github.com/users/${name}`);
      console.log(`Full name: ${user.name}.`);
      await new Promise(resolve => setTimeout(resolve, 1000));
      return;
    } catch (err) {
      if (err instanceof HttpError && err.response.status == 404) {
        alert("No such user, please reenter.");
      } else {
        console.log(`error: `, err);
        throw err;
      }
    };
  }
}
async function demoGithubUser ( ) { while ( true ) { let name = prompt ( "Enter a name?" , "Vony" ) ; try { let user = await loadJson ( ` ${ name } ` ) ; console . log ( ` ${ user . name } ` ) ; await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; return ; } catch ( err ) { if ( err instanceof HttpError && err . response . status == 404 ) { alert ( "No such user, please reenter." ) ; } else { console . log ( ` ` , err ) ; throw err ; } } ; } }
Ask for a user name until github returns a valid user
Ask for a user name until github returns a valid user
//let name = prompt("Enter a name?", "Vony"); //let done = false;   //return demoGithubUser(); // n-am stiut cum sa fac :(