Skip to content

Commit 6a9bfe1

Browse files
authored
Update article.md
Grammar suggestions
1 parent 70ca842 commit 6a9bfe1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let promise = new Promise(function(resolve, reject) {
5858
We can see two things by running the code above:
5959

6060
1. The executor is called automatically and immediately (by `new Promise`).
61-
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.
61+
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 should only call one of them when ready.
6262

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

@@ -81,7 +81,7 @@ The call to `reject(...)` moves the promise object to `"rejected"` state:
8181

8282
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.
8383

84-
A 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 an initially "pending" promise.
8585

8686
````smart header="There can be only a single result or an error"
8787
The executor should call only one `resolve` or one `reject`. Any state change is final.
@@ -263,7 +263,7 @@ It's not exactly an alias of `then(f,f)` though. There are several important dif
263263
264264
3. Last, but not least, `.finally(f)` is a more convenient syntax than `.then(f, f)`: no need to duplicate the function `f`.
265265
266-
````smart header="On settled promises handlers runs immediately"
266+
````smart header="On settled promises handlers run immediately"
267267
If a promise is pending, `.then/catch/finally` handlers wait for it. Otherwise, if a promise has already settled, they execute immediately:
268268
269269
```js run
@@ -274,7 +274,7 @@ promise.then(alert); // done! (shows up right now)
274274
```
275275
````
276276

277-
Next, let's see more practical examples of how promises can help us to write asynchronous code.
277+
Next, let's see more practical examples of how promises can help us write asynchronous code.
278278

279279
## Example: loadScript [#loadscript]
280280

0 commit comments

Comments
 (0)