JavaScript Tutorial – Timers – Making a Stopwatch

Learn how to use JavaScript Timers (setInterval) to make a stopwatch with start, pause and reset buttons.

Note: The variable divide just tells the program where to show the decimal. If you want to speed up the timer, you have to decrease the interval in the variable timer (it’s set to 1000 in the video)

The reset() function should be changed to:

function reset(){
clearInterval(timer);
timer = null;
i = 0;
document.getElementById(“timer_out”).innerHTML = (i / divide);
}

Post Author: hatefull