Created
November 20, 2014 10:51
-
-
Save MartinSvarrer/a2544649089aac4a5d3c to your computer and use it in GitHub Desktop.
Based on the article http://blog.codinghorror.com/why-cant-programmers-program/ i wanted to try to write the fizzbuzz test. This is my result of 2 min work.
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
var output; | |
for (var i = 1; i <= 100; i++) { | |
output = ""; | |
if (i % 3 == 0) | |
output = "Fizz"; | |
if (i % 5 == 0) | |
output += "Buzz"; | |
if (output === "") | |
output = i; | |
console.log(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment