Created
August 3, 2012 22:41
-
-
Save dinopetrone/3252273 to your computer and use it in GitHub Desktop.
fizbuzz on crack
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
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