Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

sleeping in js

function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}

//using sleep()
sleep(2000); //sleep for 2 seconds
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to select div js 
Javascript :: app.use 
Javascript :: url params vue 
Javascript :: jquery open page in new tab 
Javascript :: jquery force page to reload on viewport resize 
Javascript :: javascript element edit text 
Javascript :: js  
Javascript :: javascript ternary 
Javascript :: Regex get emojis 
Javascript :: javascript blob to file 
Javascript :: mongodb aggregate node.js 
Javascript :: formula for scrollbar size 
Javascript :: angular stoppropagatio 
Javascript :: ajax onchange dropdown 
Javascript :: hover con js 
Javascript :: watch with multiple variables vuejs 
Javascript :: javascript play pause button 
Javascript :: location of release apk in react native 
Javascript :: unity javascript 
Javascript :: toast message angular 
Javascript :: reload react native app 
Javascript :: filter out undefined from object javascript 
Javascript :: js data object length 
Javascript :: check if object has key lodash 
Javascript :: using multiparty with node js express 
Javascript :: json vs gson 
Javascript :: confirm javascript 
Javascript :: scrollto is not a function javascript 
Javascript :: A <Route is only ever to be used as the child of <Routes element, never rendered directly. Please wrap your <Route in a <Routes. 
Javascript :: add tab to textarea 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =