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

Jason Pallone
Jason Pallone
11,340 Points

Trying to understand JS promises

https://w.trhou.se/z5n88j6yqu

under the JavaScript folder, in Widget.js script, on line 45, I can pass anything I want as the argument, why? I don't see this function being called anywhere else passing any parameter when called? Watching this promise workshop, I've seen him make up multiple arguments for functions that were passed anywhere, i'm pretty confused here.

1 Answer

Kevin Gates
Kevin Gates
15,052 Points

This short YouTube series is the best explanation out there that I've seen: https://www.youtube.com/watch?v=QO4NXhWo_NM&list=PLRqwX-V7Uu6bKLPQvPRNNE65kBL62mVfx

Jason Pallone
Jason Pallone
11,340 Points

Nice! Thanks, I missed the part about how the previous "then" method is passed into the next "then" method as a parameter for the function being passed in that "then". It all makes sense to me now, after playing around with it for a bit in workspace! Thanks again.