Review final screencast result

Trevor Miller
InstructorTrevor Miller

Share this video with your friends

Send Tweet
Published 6 years ago
Updated 4 years ago

Our lesson has been planned, recorded, and edited. It’s ready to be uploaded to! Victory dance. Let’s see how it all turned out.

[00:00] We're ready to upload our lesson to Let's see what the finished product looks like. First let's type consturl, and let's set that equal to the GitHub API, so that's, and then we need some sort of user here. Now let's type constuser = some GitHub user name, which if we use mine, that's TrevorDMiller.

[00:24] Now we can use the global fetch function by saying fetch and then passing it our URL. This function will return a promise, so we can say .then and when this promise resolves, it will contain our response. We'll say response, and now inside of this function we can say response.json to convert our response into JSON.

[00:45] Now let's type .then, we'll have our JSON data. Let's console log out the type of the GitHub account. We see we have the type of user, because the TrevorDMiller GitHub account is of type user. If we go back up to our user string here and use Facebook, we now see that Facebook is of type organization.

[01:07] Now let's go down and type .catch and this will be used if we get an error. We will get our error, and we can use that error. Let's just log out the error in this case. Let me turn off my network connection. Now we get this type error, failed to fetch.