Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sleep 1 second

// `sleep' function from @Clever Cheetah
function sleep(delay) {
    let start = new Date().getTime();
    while (new Date().getTime() < start + delay);
}

sleep(1000);
console.log("Do something")
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #javascript #sleep
ADD COMMENT
Topic
Name
4+5 =