Example 1. The following example displays an alert message five seconds (5,000 milliseconds) after the user clicks a button. If the user clicks the second button before the alert message is displayed, the timeout is canceled and the alert does not display.
Click the button on the left for a reminder in 5 seconds; click the button on the right to cancel the reminder before it is displayed.