-
-
Save devotdev/4a2b43975d95c30ff3b6b3150f0771e6 to your computer and use it in GitHub Desktop.
Working with asynchronous operations example
This file contains hidden or 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 fetchUserData = async function(userId) { | |
| const response = await fetch(`https://api.example.com/users/${userId}`); | |
| const data = await response.json(); | |
| return data; | |
| } | |
| fetchUserData(1).then(user => console.log(user)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment