Last active
October 25, 2021 21:07
-
-
Save jcb121/0bb60e7d12dd4bc6028bb0dcc9893700 to your computer and use it in GitHub Desktop.
SetTimeout
This file contains 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
function waitfunction() { | |
var a = 5000 + new date().gettime(); | |
while (new date() < a){} | |
console.log('waitfunction() context will be popped after this line'); | |
} | |
const bar = () => { | |
setTimeout(() => { | |
console.log('timeout fired') | |
}, 0) // execute now | |
console.log('before') | |
waitfunction(); | |
console.log('after') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment