Skip to content

Instantly share code, notes, and snippets.

@dinopetrone
Created August 3, 2012 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dinopetrone/3252273 to your computer and use it in GitHub Desktop.
Save dinopetrone/3252273 to your computer and use it in GitHub Desktop.
fizbuzz on crack
var fb = {
fbArr:['','','Fizz','','Buzz','Fizz','','','Fizz','Buzz','','Fizz','','','FizzBuzz'],
next:function(){
var index = this.count();
var total = this.total();
console.log(total + ':' + this.fbArr[index])
},
count:function(){
if(typeof(arguments.callee.index) == 'undefined')arguments.callee.index =-1;
arguments.callee.index ++;
if(arguments.callee.index>=15){
arguments.callee.index = 0;
}
return arguments.callee.index
},
total:function(){
if(!arguments.callee.total)arguments.callee.total =0;
arguments.callee.total ++;
return arguments.callee.total
}
}
fb.next();
fb.next();
for(var i=0; i < 100; i ++){
fb.next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment