In this video, take a closer look at data fetching with async and await. Learn how to refactor your previous fetch sample as an async or await function in this video.
- [Instructor] We've talked about async, await … and we've talked about fetch. … Let's take a minute to look at how we can use … all of these things together. … So fetch by definition is asynchronous. … We're waiting to get some data back. … So let's go ahead … and create a function called githubRequest. … And this is going to be an async function that takes in … the login name of a user of GitHub. … And we're going to use await here. … So we're going to await the results of a fetch. … So the API that we're going to look at here is the GitHub API. … So it's api.github.com/users, and then some sort of name. … So I'm just going to use my own. … You can use your own GitHub name if you'd like to. … And we're going to make a request to this API. … So now that I know that this is working, … I'm just going to copy and paste this into our function. … And instead of hard coding this for a specific user, … we're going to take this in as an argument. … So that login will be concatenated … onto the end of the string. …
This course was created by Eve Porcello. We are pleased to offer this training in our library.
- What is ECMAScript?
- Writing and searching strings
- Writing maps
- Destructuring arrays
- Searching arrays
- Creating objects
- Destructuring objects
- Iterating with the for/of loop
- Getting and setting class values
- Using ECMAScript functions
- Building and returning promises
- Using async/await syntax
Skill Level Intermediate
1. What Is ECMAScript?
What is ECMAScript?1m 44s
2. ECMAScript Variables and Data Structures
3. Arrays and Array Methods
Destructuring arrays1m 34s
4. ECMAScript Objects
5. ECMAScript Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.