Skip to content

Instantly share code, notes, and snippets.

@usagi
Created February 20, 2012 14:38
Show Gist options
  • Save usagi/1869496 to your computer and use it in GitHub Desktop.
Save usagi/1869496 to your computer and use it in GitHub Desktop.
const number_of_begin = 1;
const number_of_end = 20;
const word_of_fizz = "Fizz";
const word_of_buzz = "Buzz";
for(var n=number_of_begin;n<=number_of_end;++n){
var is_fizz = n % 3 === 0;
var is_buzz = n % 5 === 0;
if(is_fizz) console.log(word_of_fizz);
if(is_buzz) console.log(word_of_buzz);
else if(!is_fizz) console.log(n);
// for debug
console.log("debug log:",n,is_fizz,n % 3 === 0,is_buzz,n % 5 === 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment