Skip to content

Instantly share code, notes, and snippets.

@allangrds
Created October 26, 2020 20:56
Show Gist options
  • Save allangrds/a899ffed035918dceac012fe4ae7ee74 to your computer and use it in GitHub Desktop.
Save allangrds/a899ffed035918dceac012fe4ae7ee74 to your computer and use it in GitHub Desktop.
Promise.all([
fetch('https://api.github.com/users/iliakan'),
fetch('https://api.github.com/users/taylorotwell')
])
.then(async([res1, res2]) => { //async function
const a = await res1.json();
const b = await res2.json();
console.log(a.login + ' has ' + a.public_repos + ' public repos on GitHub');
console.log(b.login + ' has ' + b.public_repos + ' public repos on GitHub');
})
.catch(error => {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment