Using a new Promise with SetTimeout.
IntuitionI thought about creating a promise that resolves in the time we receive as a parameter, and for the time I thought of a setTimeout.ApproachUse a promis
# Intuition
I thought about creating a promise that resolves in the time we receive as a parameter, and for the time I thought of a setTimeout.

# Approach
Use a promise that resolves with a setTimeout to the number of milliseconds received in the function parameter, then return the parameter's value.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g.  -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

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

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