HTML5 Game Development: Keeping Track with the Timer Object - dummies

HTML5 Game Development: Keeping Track with the Timer Object

By Andy Harris

Part of HTML5 Game Development For Dummies Cheat Sheet

The Timer object will help you keep track of time in your games. You can have as many timers as you wish in your game.

timerObj = new Timer() Creates a new Timer object called
timerObj. The counter automatically
begins counting when it is created.
reset() Resets the timer so it begins counting at zero.
getElapsedTime() Returns the number of seconds since the timer was created or
reset.