Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Created March 3, 2011 20:08
Show Gist options
  • Save JamieMason/853421 to your computer and use it in GitHub Desktop.
Save JamieMason/853421 to your computer and use it in GitHub Desktop.
javascriptmasterclass.com - exercise 2
(function(name, scope){
// Code
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);
index--;
}
function countdown(){
index = 10;
iterate();
}
scope[name] = countdown;
})('countdown', this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment