This commit is contained in:
Ilya Kantor 2019-03-07 15:14:56 +03:00
parent 06d7123df1
commit 3113f7deef
4 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,20 @@
That's the case when knowing how it works inside is helpful.
Just treat `async` call as promise and attach `.then` to it:
```js run
async function wait() {
await new Promise(resolve => setTimeout(resolve, 1000));
return 10;
}
function f() {
// shows 10 after 1 second
*!*
wait().then(result => alert(result));
*/!*
}
f();
```