From 810f40a03a112d10b42137636d1871e867b1f2ee Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 5 Jan 2024 23:23:15 -0500 Subject: 26121 --- 2621/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 2621/main.js (limited to '2621') 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 + */ -- cgit v1.2.3