Skip to content

Instantly share code, notes, and snippets.

@ashleyconnor
Created December 4, 2016 14:56
Show Gist options
  • Save ashleyconnor/03638c1cd5718e48feaf926f60a9ba7a to your computer and use it in GitHub Desktop.
Save ashleyconnor/03638c1cd5718e48feaf926f60a9ba7a to your computer and use it in GitHub Desktop.
async/await example
async function main () {
try {
const res = await fetch('https://api.github.com/orgs/facebook');
const json = await res.json();
console.log(json);
} catch (e) {
// handle error
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment