DEV Community

Cover image for Illustrated JS: Promises

Illustrated JS: Promises

Marina Costa on August 11, 2020

While learning JavaScript and programming in general, I find it useful to create some analogies to understand the concepts better. Here I will shar...
Collapse
 
kosich profile image
Kostia Palchyk

Ah, yet again a great illustrated article, Marina!

And one can simultaneously start (baking cake & preparing icing) aand order a pie! Then eat the first that's available (Promise.race)!

Warning: don't try to do that at home, you'll end up with both: a cake and a dessert 🙂

btw, Marina , did you know that you can create series of articles in dev.to? press "edit" -> open the "nut" 🔩 menu at the bottom -> add text to series field

Collapse
 
marinafroes profile image
Marina Costa

Thanks, Kostia! Yes, I thought about including Promise.race() in the example, then I realised it could be confusing. Like you said, in "real life" you'd ended up with both the cake and the pie, right? 🤣 Unless you cancel the delivery or throw away the unfinished cake (not a good idea).

And thanks for letting me know about the series of article, I didn't know that. 😀

Collapse
 
mattcale profile image
Matthew Cale

Really excellent post :) Thank you.

Collapse
 
marinafroes profile image
Marina Costa

Thanks, I'm glad you liked it. :D

Collapse
 
schnubb profile image
Schnubb

when I try to bake a cake, it always ends with ordering... so bad at baking cake..

Collapse
 
marinafroes profile image
Marina Costa

Same here! I don't even bother trying to bake the cake, I go straight to the point and order something. 🥧 😅

Collapse
 
abhayselva profile image
abhayselva

Fantastic,explanations were really good!
THANK YOU!

Collapse
 
marinafroes profile image
Marina Costa

Thanks, happy to read this. :D

Collapse
 
racquelsimone profile image
Racquel WS • Edited

This was helpful. Newer to programming and had seen “Promises” when reading, but hadn’t looked into them yet.

Collapse
 
marinafroes profile image
Marina Costa

Thanks, I'm glad it helped. :D

Collapse
 
davidbruchmann profile image
David Bruchmann

Greatly visualized ;-)

I'm missing a bit concrete code where the different combinations are shown, nevertheless it's a good start with promises for me ;-)

Collapse
 
sumusiriwardana profile image
Sumudu Siriwardana

Great article, Marina! Love the illustrations!