What is timing event?
“JavaScript can be executed in time-intervals. This is called timing events.
The window object allows execution of code at specified time intervals.
These time intervals are called timing events.
The two key methods to use with JavaScript are:
setTimeout(function, milliseconds)
Executes a function, after waiting a specified number of milliseconds.setInterval(function, milliseconds)
Same as setTimeout(), but repeats the execution of the function continuously."
by W3C School
Basic timing event
<script type="text/javascript">
function init(){
window.setTimeout(countdown, 1000);
}
function countdown (){
alert("Hi there!");
}
</script>
The unit is milliseconds, so 1000 milliseconds = 1 second.
The window will popup in 1 second.
