Skip to content

Instantly share code, notes, and snippets.

@onderaltintas
Created September 16, 2022 19:14
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 onderaltintas/ca20a9b13bafe0563b6570f29f3a900e to your computer and use it in GitHub Desktop.
Save onderaltintas/ca20a9b13bafe0563b6570f29f3a900e to your computer and use it in GitHub Desktop.
function doit(sec){
console.log("execution is starting for "+ sec + " seconds. Now:"+(new Date()).toString());
var now = Date.now();
while(Date.now() - now < sec * 1000);
console.log("execution succeed for "+sec+" seconds. Now:"+(new Date()).toString());
}
setTimeout(function(){
doit(1);
},0);
setTimeout(function(){
doit(2);
},0);
setTimeout(function(){
doit(3);
},0);
@onderaltintas
Copy link
Author

Js developerlar bunu öğrensin:
https://www.youtube.com/watch?v=8aGhZQkoFbQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment