File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,12 @@ function f() {
83
83
}
84
84
```
85
85
86
- We can get such error in case if we forget to put ` async ` before a function. As said, ` await ` only works inside ` async function ` .
86
+ We will get this error if we do not put ` async ` before a function. As said, ` await ` only works inside an ` async function ` .
87
87
````
88
88
89
- Let's take `showAvatar()` example from the chapter <info:promise-chaining> and rewrite it using `async/await`:
89
+ Let's take the `showAvatar()` example from the chapter <info:promise-chaining> and rewrite it using `async/await`:
90
90
91
- 1. We'll need to replace `.then` calls by `await`.
91
+ 1. We'll need to replace `.then` calls with `await`.
92
92
2. Also we should make the function `async` for them to work.
93
93
94
94
```js run
@@ -122,7 +122,7 @@ showAvatar();
122
122
Pretty clean and easy to read, right? Much better than before.
123
123
124
124
````smart header="`await` won't work in the top-level code"
125
- People who are just starting to use `await` tend to forget that, but we can't write `await` in the top-level code. That wouldn't work:
125
+ People who are just starting to use `await` tend to forget the fact that we can't use `await` in top-level code. For example, this will not work:
126
126
127
127
```js run
128
128
// syntax error in top-level code
You can’t perform that action at this time.
0 commit comments