3 ms·
What's a promise? This article seems to assume you know that when you start reading. Here's my understanding: Sometimes in code you get into callback hell. A
by tieTYT 13y ago
What's a promise? This article seems to assume you know that when you start reading. Here's my understanding: Sometimes in code you get into callback hell. A callback calls a callback calls a callback. Your code starts to grow horizontally more than vertically like this:
callback1
callback2
callback3
callback3ReactionToFailure
callback2ReactionToFailure
callback1ReactionToFailure
As a result, the code is hard to read because it doesn't flow sequentially.
Promises are a solution to that problem. They let you take something that would be callback hell and write it sequentially.
Keep in mind it's the blind leading the blind here. I just learned this term a month ago. Please correct me if I'm wrong.
That said, I found http://promises-aplus.github.io/promises-spec/#terminology http://promises-aplus.github.io/promises-spec/#terminology to be more informative than the article itself (no offense)