update snippets 0-All
This commit is contained in:
@ -6,11 +6,12 @@ Delay executing part of an `async` function, by putting it to sleep, returning a
|
||||
|
||||
```js
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
/*
|
||||
```
|
||||
|
||||
```js
|
||||
async function sleepyWork() {
|
||||
console.log('I\'m going to sleep for 1 second.');
|
||||
await sleep(1000);
|
||||
console.log('I woke up after 1 second.');
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user