DEV Community

Cover image for 3 Facts About Promises

3 Facts About Promises

K on December 28, 2017

cover image by Carmella Fernando on Flickr, cropped by me Promises are the new found love of JavaScript developers, but often I read things like "...
Collapse
 
ardennl profile image
Arden de Raaij

Let me just say: Thanks a million K! Your articles are really good and have been seriously helpful 🙌🏼. I hope you'll do another 50 in 2018!

Collapse
 
kayis profile image
K

That's always good to hear :)

It also helps myself to write, sometimes I find out that I'm not knowing as much as I thought :D

Collapse
 
hom3chuk profile image
Eugene Chekan

Congrats on the 50th 👏
Another thing that makes promises cool is how they race and fulfill completely.

PS: you have a minor typo in first snippet at setTimoeut 🤓

Collapse
 
kayis profile image
K

Thanks!

Yes, the other methods are nice too, but all is the one I used most often.

PS: fixed the typo :D

Collapse
 
damcosset profile image
Damien Cosset

I look forward to read more from you next year!

Collapse
 
pchauhan13 profile image
Prashant Singh Chauhan

Great explanation. Will be waiting for your next one!

Collapse
 
jenc profile image
Jen Chan

It's been like 2 years since I learned about promises. I love how compact and reliable they are for doing async things in a sequence. I'm a bit confused as to when to use resolve and what that means.

Collapse
 
kayis profile image
K
Promise.resolve(999)

is a shortcut for

new Promise(resolve => resolve(999))