Skip to content

Instantly share code, notes, and snippets.

@ChrisMBarr
Created March 3, 2013 20:44
Show Gist options
  • Save ChrisMBarr/5078194 to your computer and use it in GitHub Desktop.
Save ChrisMBarr/5078194 to your computer and use it in GitHub Desktop.
Mission Clock Code Samples
(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