Skip to content

Instantly share code, notes, and snippets.

@Tribhuwan-Joshi
Created May 15, 2023 03:54
Show Gist options
  • Save Tribhuwan-Joshi/3d8fe7342ef5f760f46088091d07cbd6 to your computer and use it in GitHub Desktop.
Save Tribhuwan-Joshi/3d8fe7342ef5f760f46088091d07cbd6 to your computer and use it in GitHub Desktop.
Leetcode JS
async function sleep(millis){
return new Promise(res => setTimeout(res,millis) ) // return a promise that will resolve after millis milliseconds
}
const t = Date.now();
sleep(100).then(()=>console.log(Date.now() - t ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment