Skip to content

Instantly share code, notes, and snippets.

@sadamiak
Last active April 30, 2020 20:38
Show Gist options
  • Save sadamiak/2ed7ac8a1a43717ef83b6f5210b3d001 to your computer and use it in GitHub Desktop.
Save sadamiak/2ed7ac8a1a43717ef83b6f5210b3d001 to your computer and use it in GitHub Desktop.
fizzbuzz with bug
var upperBand = 20;
var lowerBand = 1;
function fizzBuzz() {
var result = "";
for (var repetition = lowerBand; repetition <= 20; repetition++) {
if (repetition % 3 === 0 && repetition === 0)
result += "FizzBuzz ";
else if (repetition % 3 === 0)
result += "Fizz ";
else if (repetition % 5 === 0)
result += "Buzz ";
else
result += repetition + " ";
}
return result.trim();
}
fizzBuzz();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment