Skip to content

Instantly share code, notes, and snippets.

@jcb121
Last active October 25, 2021 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcb121/0bb60e7d12dd4bc6028bb0dcc9893700 to your computer and use it in GitHub Desktop.
Save jcb121/0bb60e7d12dd4bc6028bb0dcc9893700 to your computer and use it in GitHub Desktop.
SetTimeout
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