g2601_2700.s2621_sleep.solution.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
// #Easy #2023_08_31_Time_40_ms_(99.59%)_Space_42.3_MB_(77.98%)
async function sleep(millis: number): Promise {
await new Promise((resolve) => setTimeout(resolve, millis))
}
/*
* let t = Date.now()
* sleep(100).then(() => console.log(Date.now() - t)) // 100
*/
export { sleep }