Skip to content

Instantly share code, notes, and snippets.

@YerlinMatu
Last active July 18, 2018 17:12
Show Gist options
  • Save YerlinMatu/a35e5cad4cedab7d82207d0049a1b649 to your computer and use it in GitHub Desktop.
Save YerlinMatu/a35e5cad4cedab7d82207d0049a1b649 to your computer and use it in GitHub Desktop.
Function Async
const getUsers = async () => {
try {
const response = await fetch('https://jsonplaceholder.typicode.com/users')
return response.json();
} catch (error) {
throw error;
}
}
getUsers()
.then(console.info)
.catch(console.error);
@YerlinMatu
Copy link
Author

short function async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment