re: Explain JavaScript Promises like I am five. VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Think of a regular JS array as an envelope. You put one (or more) values into the envelope, and it gives you extra behaviour like map and reduce ...
 

I get it now...

In fact, we can say that JavaScript arrays are envelopes that have the special property of including multiple values.
Promises are similar. They are envelopes just like arrays are, but the special property they have is they handle future/potential/asynchronous values.

Thanks a lot!

 

Yup!

The non-eli5 answer is that Promises are (not 100% but basically) monads that encode asynchronous behaviour

code of conduct - report abuse