Skip to content

Instantly share code, notes, and snippets.

@MartinSvarrer
Created November 20, 2014 10:51
Show Gist options
  • Save MartinSvarrer/a2544649089aac4a5d3c to your computer and use it in GitHub Desktop.
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.
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