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 Make a Promise?

dont understand promises.

Steven Parker i came here from the https://teamtreehouse.com/library/ajax-basics/programming-ajax/working-with-the-fetch-api section of the course.

Having a hard time understanding promises. Should i end the ajax basics first and then try to come back here if i can understand correctly. this workshop doesnt looks like its for starters. what do you say? is it good if i do it like that?

3 Answers

Nour El-din El-helw
Nour El-din El-helw
8,241 Points

Well, I know this is late but I just wanted to tell you that, you're not alone, promises where hard to understand for me too and other programmers. What I did is I searched youtube for 'javascript promises' and found an awesome tutorial explaining promises in in a really simple and friendly way. I think maybe treehouse made this for more experienced programmers or something, I don't know. However, the teacher gave good examples. This is the tutorial on youtube if you would like to watch it https://www.youtube.com/watch?v=QO4NXhWo_NM&list=PLRqwX-V7Uu6bKLPQvPRNNE65kBL62mVfx. I didn't watch all of it, just watched till the point where I can understand what's going on exactly in this workshop. Hope this helps :)

Thanks a lot.

Steven Parker
Steven Parker
231,275 Points

Perhaps "a day or so" was a bit of an underestimation. I guess sometimes it might take a few months to get the answer you really like. :laughing:

Yeah i guess lol. I tinkered a lot with promises and now has a understanding of them. Remeber the time i asked a question where I couldn’t understand what is return in a function lol. How time goes by is crazy

Nour El-din El-helw thanks for posting this video here! Just subscribed for that channel. The video passed by so quickly because the teaching method of the guy is so engaging!

WOW!

Steven Parker
Steven Parker
231,275 Points

:bell: I was alerted by your tag, but there are many folks here willing to help. When you ask a question, try giving folks a chance to answer (a day or so) before asking or tagging someone specific.

I think you can probably complete the "fetch" workshop without completely understanding promises. You could do the promises workshop afterwards. But if you prefer, you could do them in the opposite order; I don' t think either one is dependent on the other.

Thanks

Roger Hwang
Roger Hwang
3,851 Points

I don't see how this can be complicated as it's almost like an if else statement unless you want some deeper meaning of things.

  1. Create promise object with a resolve statement
  2. capture value with a chained .then statement

As simple as that is all we need to know?