Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript wait 1 second

  setTimeout(function(){ 
    console.log("Ready")
}, 1000);
Comment

javascript wait 1 second

setTimeout(() => {console.log('1 second finished!')}, 1000);
Comment

js wait 5 second

function sleep(num) {
	let now = new Date();
	const stop = now.getTime() + num;
	while(true) {
		now = new Date();
		if(now.getTime() > stop) return;
	}
}

sleep(1000)
console.log('delay 1 second');
Comment

PREVIOUS NEXT
Code Example
Javascript :: js loop every second 
Javascript :: javascript capitalize string 
Javascript :: javascript get element by class name 
Javascript :: window resize event javascript 
Javascript :: drupal 8 get page node 
Javascript :: JS Fetch API Post Request 
Javascript :: google dino game hack 
Javascript :: js mouse position relative to element 
Javascript :: javascript knowing when space is pressed 
Javascript :: jquery ajax basic authentication 
Javascript :: remove special characters from string javascript 
Javascript :: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. 
Javascript :: ERROR in ./server/server.js Module build failed (from ./node_modules/babel-loader/lib/index.js): 
Javascript :: how to use lodash in angular 
Javascript :: authfunctions react 
Javascript :: js object to querystring 
Javascript :: emmet not working react js 
Javascript :: js date add 1 day 
Javascript :: mui typography bold 
Javascript :: js canvas triangle 
Javascript :: how to refresh slick after tab function 
Javascript :: yup email validation 
Javascript :: remove previous datatable instance 
Javascript :: how to adjust the caledar height fullcalendar 
Javascript :: react empty space 
Javascript :: jquery datepicker no past dates 
Javascript :: how to reset checkbox jquery 
Javascript :: jquery wait for element to exist 
Javascript :: filter array with unique objects javascript 
Javascript :: How to tell if an attribute exists on an object 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =