From 7ef4553212fe4f3b4e268bc1c41931acee636482 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:24:58 -0500 Subject: [PATCH] Create README - LeetHub --- 2621-sleep/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2621-sleep/README.md diff --git a/2621-sleep/README.md b/2621-sleep/README.md new file mode 100644 index 0000000..f9a58ad --- /dev/null +++ b/2621-sleep/README.md @@ -0,0 +1,29 @@ +
Given a positive integer millis, write an asynchronous function that sleeps for millis milliseconds. It can resolve any value.
+
Example 1:
+ +
+Input: millis = 100
+Output: 100
+Explanation: It should return a promise that resolves after 100ms.
+let t = Date.now();
+sleep(100).then(() => {
+ console.log(Date.now() - t); // 100
+});
+
+
+Example 2:
+ ++Input: millis = 200 +Output: 200 +Explanation: It should return a promise that resolves after 200ms. ++ +
+
Constraints:
+ +1 <= millis <= 1000