A Pen by Yerlin Matu on CodePen.
Last active
July 18, 2018 17:12
-
-
Save YerlinMatu/a35e5cad4cedab7d82207d0049a1b649 to your computer and use it in GitHub Desktop.
Function Async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
A Pen by Yerlin Matu on CodePen.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
short function async.