-
-
Save gu-stav/b5087d8dabab6c61c6dcf3469dc00d75 to your computer and use it in GitHub Desktop.
Test setTimouet
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
console.log('first script start'); | |
function sleep(milliSeconds){ | |
var startTime = new Date().getTime(); // get the current time | |
while (new Date().getTime() < startTime + milliSeconds); // hog cpu until time's up | |
} | |
sleep(2000) | |
console.log('first script end'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment