Created
February 2, 2012 19:29
-
-
Save lazyval/1725263 to your computer and use it in GitHub Desktop.
FizzBuzz in JS
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
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