Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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');
 
PREVIOUS NEXT
Tagged: #js #wait
ADD COMMENT
Topic
Name
4+5 =