Created
February 20, 2012 14:38
-
-
Save usagi/1869496 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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