In this example the function waits for the amount of time specified in the slideDelay field and then calls the slideAd function passing three parameters.
The setInterval() function works similarly to setTimeout except that while the setTimeout will run the specified function once after the specified delay the setInterval will run the function again and again after waiting the required time.
Another event might occur during the time delay period between the running of the setTimeout or setInterval function and its running the specified code that means that you no longer want that code to run. By assigning the value returned from the setTimeout or setInterval function to a variable we can pass that variable to the clearTimeout or clearInterval function to cancel the timer.
By combining the timed event handlers with any of the other event handlers that you already know you will be able to delay the running of the code triggered by that event by a set amount of time.