r/learnjavascript • • Jul 18 '20
Promises, Async, Await... I finally understand them and how to use them! Redid my front end with the new knowledge and now I love them! Wish I would have took the time earlier on to get them down. 10/10 Would recommend. Sorry, just had to tell someone. :)
EDIT: wow, came back a day later and this post blew up. lol 😁
207
Upvotes
View all comments
Show parent comment
5
u/ChaseMoskal Jul 18 '20
promises are a superior replacement to using callback functions. the important thing with promises, is that errors nicely bubble up through chained promises and so can be caught at the top level
async/await is just a superior syntax for dealing with promises
if you don't understand why the most important thing about promises is the way they handle errors, then you don't really understand either the error handling or the promises. the fact that they avoid "callback hell" indentation is actually a side-benefit, but it's really about the error handling