JavaScript

Jason Pallone
Jason Pallone
9,482 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
13,212 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
9,482 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.