Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

How to convert the code from .then .catch to use async / await ?

I dont understand the direction of this course with all the back and forth. Gill had us previously convert this code into using Fetch and .then / .catch. before the async/await course.

Now, that async/await is introduced, why isn't Gill using the last course code of us using .then and .catch to convert that into using async/await?

Instead Gill goes back to a few courses, all the way back to how we wrote the code from the "Understanding Promise" course. To use as an example to convert into async / await. Which is confusing because we changed that code to use fetch and .then / .catch

1 Answer

Nils Kriedner
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Nils Kriedner
Full Stack JavaScript Techdegree Graduate 30,932 Points

Hi Gremyko,

sorry that you feel confused about the content of that course.

I actually just recently did it and to me Guil just presented different ways to do the same thing. So therefore he is not really building on top of the code of one method, but shows a different approach to do the same thing in each section (if I remember it right).

Wether you finally want to use the newest async/await keywords or stick to one of the "older" ways of writing asynchronous code is personal preference. And of course it also depends on the size and length of your functions.

Does this make more sense to you viewing it the way I described?

Best wishes to your coding journeys, Nils