Sleep

From codeTank

Jump to: navigation, search

Contents

Description

sleep will pause execution for a certain amount of seconds.

Arguments

sleep() -- equivalent to sleep(0)
sleep(seconds)

sleep has one argument, specifying the duration in seconds. If the argument is omitted, then the default behavior is to sleep for 0 seconds, which creates the smallest pause possible. sleep internally uses milliseconds, so the second smallest pause possible would be sleep(0.001). Anything smaller is the same as sleep(0).

Returns

sleep does not return anything.

Example

alert("I will alert you in 5.8 seconds")
sleep(5.8)
alert("Hello!")

See Also

Personal tools