Logo

Programming-Idioms

History of Idiom 45 > diff from v22 to v23

Edit summary for version 23 by :

Version 22

2015-09-04, 13:29:11

Version 23

2015-10-21, 12:12:16

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Code
setTimeout(function(){
	// Instructions after delay
},5000);
Code
setTimeout(function(){
	// Instructions after delay
},5000);
Comments bubble
Javascript does not have a sleep function. The execution flow must be structured with a callback (it can be a closure).
Unit is millisecond.
Comments bubble
Javascript does not have a sleep function. The execution flow must be structured with a callback (it can be a closure).
Unit is millisecond.
Doc URL
https://developer.mozilla.org/en/docs/Web/API/WindowTimers/setTimeout