Skip to content

Instantly share code, notes, and snippets.

@lazyval
Created February 2, 2012 19:29
Show Gist options
  • Save lazyval/1725263 to your computer and use it in GitHub Desktop.
Save lazyval/1725263 to your computer and use it in GitHub Desktop.
FizzBuzz in JS
for(var i=1; i < 21; i++) {
var message = "";
if(i % 3 === 0) {
message += "Fizz";
}
if( i % 5 === 0) {
message += "Buzz";
}
if(!message) {
message = i;
}
console.log(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment