Created
March 3, 2013 20:44
-
-
Save ChrisMBarr/5078194 to your computer and use it in GitHub Desktop.
Mission Clock Code Samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
//Numbers | |
var num = 0; | |
var perMinute = 75; | |
var perSecond = perMinute / 60; | |
//Element selection | |
var count = document.getElementById("count"); | |
function update(){ | |
//Add the per-second value to the total | |
num += Math.round(perSecond); | |
//Display the count rounded without a decimal | |
count.innerHTML = num; | |
} | |
//Run the update function once every second | |
setInterval(update, 1000/perSecond); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment