Skip to content

Commit 89ff13f

Browse files
committed
minor
1 parent 07319c7 commit 89ff13f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

1-js/11-async/02-promise-basics/article.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ We can see two things by running the code above:
6060
1. The executor is called automatically and immediately (by `new Promise`).
6161
2. The executor receives two arguments: `resolve` and `reject` — these functions are pre-defined by the JavaScript engine. So we don't need to create them. We only should call one of them when ready.
6262

63-
After one second of "processing" the executor calls `resolve("done")` to produce the result:
63+
After one second of "processing" the executor calls `resolve("done")` to produce the result. This changes the state of the `promise` object:
6464

65-
![](promise-resolve-1.svg)
65+
![](promise-resolve-1.svg)
6666

6767
That was an example of a successful job completion, a "fulfilled promise".
6868

@@ -75,14 +75,16 @@ let promise = new Promise(function(resolve, reject) {
7575
});
7676
```
7777

78+
The call to `reject(...)` moves the promise object to `"rejected"` state:
79+
7880
![](promise-reject-1.svg)
7981

80-
To summarize, the executor should do a job (something that takes time usually) and then call `resolve` or `reject` to change the state of the corresponding Promise object.
82+
To summarize, the executor should do a job (something that takes time usually) and then call `resolve` or `reject` to change the state of the corresponding promise object.
8183

82-
The Promise that is either resolved or rejected is called "settled", as opposed to a initially "pending" Promise.
84+
A promise that is either resolved or rejected is called "settled", as opposed to a initially "pending" promise.
8385

8486
````smart header="There can be only a single result or an error"
85-
The executor should call only one `resolve` or one `reject`. The promise's state change is final.
87+
The executor should call only one `resolve` or one `reject`. Any state change is final.
8688
8789
All further calls of `resolve` and `reject` are ignored:
8890

0 commit comments

Comments
 (0)