Skip to content

Instantly share code, notes, and snippets.

@ungoldman
Created August 3, 2012 20:50
Show Gist options
  • Save ungoldman/3251385 to your computer and use it in GitHub Desktop.
Save ungoldman/3251385 to your computer and use it in GitHub Desktop.
Quest for the Shortest FizzBuzz
for (var i=1;i<=100;i++){
var s = '';
if (i % 3 === 0) s += 'Fizz';
if (i % 5 === 0) s += 'Buzz';
console.log(s ? s : i);
}
@ibrokemycomputer
Copy link

@SiddharthShyniben You gotta use console.log for the challenge, however even with replacing alert you still are the shortest I've seen at 62 characters!!! 🎉

for(i=0;++i<101;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment