Update article.md
This commit is contained in:
parent
b540d85014
commit
6c2ece0860
1 changed files with 1 additions and 1 deletions
|
@ -67,7 +67,7 @@ f();
|
||||||
|
|
||||||
The function execution "pauses" at the line `(*)` and resumes when the promise settles, with `result` becoming its result. So the code above shows "done!" in one second.
|
The function execution "pauses" at the line `(*)` and resumes when the promise settles, with `result` becoming its result. So the code above shows "done!" in one second.
|
||||||
|
|
||||||
Let's emphasize that: `await` literally makes JavaScript wait until the promise settles, and then go on with the result. That doesn't cost any CPU resources, because the engine can do other jobs meanwhile: execute other scripts, handle events etc.
|
Let's emphasize: `await` literally makes JavaScript wait until the promise settles, and then go on with the result. That doesn't cost any CPU resources, because the engine can do other jobs meanwhile: execute other scripts, handle events etc.
|
||||||
|
|
||||||
It's just a more elegant syntax of getting the promise result than `promise.then`, easier to read and write.
|
It's just a more elegant syntax of getting the promise result than `promise.then`, easier to read and write.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue