Answers for "js thread sleep"

5

sleep javascript

//Javascipt is asyncronous so you can't pause/block code execution
//You can delay doing something with setTimeout
setTimeout(function(){
 	alert("Sup!"); 
}, 2000);//wait 2 seconds
Posted by: Guest on July-23-2019
0

javascript sleep thread

var millisecondsToWait = 500;
setTimeout(function() {
    // Whatever you want to do after the wait
}, millisecondsToWait);
Posted by: Guest on September-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language