diff options
-rw-r--r-- | 2621/main.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/2621/main.js b/2621/main.js new file mode 100644 index 0000000..f80b146 --- /dev/null +++ b/2621/main.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +"use strict"; + +/** + * @param {number} millis + * @return {Promise} + */ +async function sleep(millis) { + await new Promise((resolve) => setTimeout(resolve, millis)); +} + +/** + * let t = Date.now() + * sleep(100).then(() => console.log(Date.now() - t)) // 100 + */ |