Skip to content

Instantly share code, notes, and snippets.

@pprathameshmore
Created May 7, 2020 13:00
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 pprathameshmore/d6661d3a1a7c1e537e82e7a645611f67 to your computer and use it in GitHub Desktop.
Save pprathameshmore/d6661d3a1a7c1e537e82e7a645611f67 to your computer and use it in GitHub Desktop.
console.log('Starting the main thread');
console.log('Getting started');
wasteTime();
console.log('In the middle');
wasteTime();
console.log('All done');
console.log('Still in main thread');
function wasteTime() {
const end = Date.now() + 3000;
while (Date.now() < end) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment