Skip to content

Commit 1b31575

Browse files
authored
promise chain flow
1 parent 4d01fc2 commit 1b31575

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: 1-js/11-async/03-promise-chaining/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ The idea is that the result is passed through the chain of `.then` handlers.
3636

3737
Here the flow is:
3838
1. The initial promise resolves in 1 second `(*)`,
39-
2. Then the `.then` handler is called `(**)`.
39+
2. Then the `.then` handler is called `(**)` wich in turn creates a new promise.
4040
3. The value that it returns is passed to the next `.then` handler `(***)`
4141
4. ...and so on.
4242

4343
As the result is passed along the chain of handlers, we can see a sequence of `alert` calls: `1` -> `2` -> `4`.
4444

4545
![](promise-then-chain.svg)
4646

47-
The whole thing works, because a call to `promise.then` returns a promise, so that we can call the next `.then` on it.
47+
The whole thing works, because every call to a `.then` returns a new promise, so that we can call the next `.then` on it.
4848

4949
When a handler returns a value, it becomes the result of that promise, so the next `.then` is called with it.
5050

0 commit comments

Comments
 (0)