Update sleep.md
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
### Sleep
|
### Sleep
|
||||||
|
|
||||||
If you have an async function and you want to delay executing part of it. you can put your async function to sleep(in miliseconds).
|
Delay executing part of an `async` function, by putting it to sleep, returning a `Promise`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|||||||
Reference in New Issue
Block a user