Open tbtommyb opened 8 years ago
Another advantage of creating a sub-function for the code inside the setInterval is you can test whether it correctly converts milliseconds to formatted time. And you can pass it in 3600001 millseconds to check that it doesn't display about 60 minutes
You could make sub functions for the code in each of the comment headings, which would help split it up and you could reuse the bit that pads the numbers with '0's. Or you could use the
.toISOString
method to get the time as a string.At first I thought that making the setInterval run every 10ms, even when you've paused the timer, is inefficient but actually it makes the rest of the code a lot simpler so I like it!