Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js wait for time

function sleep(milliseconds) {
  const start = Date.now();
  while (Date.now() - start < milliseconds);
}

console.log("Hello");
sleep(2000);
console.log("World!");
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #js #wait #time
ADD COMMENT
Topic
Name
1+3 =