Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sleep

function sleep(milliseconds) {
  const date = Date.now();
  let currentDate = null;
  do {
    currentDate = Date.now();
  } while (currentDate - date < milliseconds);
}

console.log("Hello");
sleep(2000);
console.log("World!");
Source by stickynotepickles.herokuapp.com #
 
PREVIOUS NEXT
Tagged: #javascript #sleep
ADD COMMENT
Topic
Name
1+1 =