반응형

javascript - setTimeOut

 

 

Example

Display an alert box after 3 seconds (3000 milliseconds):

 

setTimeout(function(){ alert("Hello"); }, 3000);

 

Definition and Usage

The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.

Tip: 1000 ms = 1 second.

Tip: The function is only executed once. If you need to repeat execution, use the setInterval() method.

Tip: Use the clearTimeout() method to prevent the function to run. 

반응형

+ Recent posts