// Create a new _Date_ object with the current time.
var current_time = new Date();
Time-Out
// Time-Outs
// Calls a function or executes a code snippet after a specified delay.
setTimeout( function(){
// Do something here.
}, 5000);
// Or...
function message(){ alert( 'Hi' ); }
setTimeout( message, 1000 );
Timed Intervals
// Timed Intervals
// Calls a function or executes a code snippet repeatedly,
// with a fixed time delay between each call to that function.
// Returns an intervalID.
var intervalTimer = window.setInterval( function(){
// Do something here.
}, 6000);
// Or...
function message(){ alert( 'Hi' ); }
var intervalTimer = window.setInterval( message, 6000);
// Stop the interval.
clearInterval( intervalTimer );