Sleep
Approach
The functionsleep(millis):
Returns a Promise that resolves aftermillismilliseconds.
UsessetTimeout(resolve, millis)to delay resolution.


await sleep(2

# Approach
<!-- Describe your approach to solving the problem. -->
1. The function `sleep(millis)`:
    - Returns a Promise that resolves after `millis` milliseconds.
    - Uses `setTimeout(resolve, millis)` to delay resolution.
2. `await sleep(2000)` pauses execution for 2 seconds before continuing.
3. Works inside `async` functions for controlled delays.



# Code
```javascript []
/**
 * @param {number} millis
 * @return {Promise}
 */
async function sleep(millis) {
    return new Promise(resolve => setTimeout(resolve, millis));
}

/** 
 * let t = Date.now()
 * sleep(100).then(() => console.log(Date.now() - t)) // 100
 */
```
['JavaScript']