Created
September 6, 2018 20:07
-
-
Save evonsdesigns/e499d43189242e88bb29c4e23a7998f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeout = ms => new Promise(res => setTimeout(res, ms)) | |
function convinceMe (convince) { | |
let unixTime = new Date().getTime() | |
console.log(`Delay ${convince} at ${unixTime}`) | |
return unixTime | |
} | |
async function delay () { | |
let start = convinceMe('started') | |
await timeout(5501) | |
let end = convinceMe('finished') | |
console.log('Diff:', end - start) | |
} | |
delay() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment