Skip to content

Instantly share code, notes, and snippets.

@smihica
Created January 25, 2012 02:20
Show Gist options
  • Save smihica/1674209 to your computer and use it in GitHub Desktop.
Save smihica/1674209 to your computer and use it in GitHub Desktop.
fizzbuzzjs
(function(){
for(var i=1,f=1,b=1,fizz=3,buzz=5;i<101; i++) {
var r = ''; var fp=(f*fizz==i); var bp=(b*buzz==i);
if(fp||bp) {
if (fp) { r+="Fizz"; f++;}
if (bp) { r+="Buzz"; b++;}
} else r+=i;
console.log(r);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment