Skip to content

Instantly share code, notes, and snippets.

@seanquijote
Created February 17, 2021 13:15
Show Gist options
  • Save seanquijote/7598d96f2b857e095920b2ec5c32be3f to your computer and use it in GitHub Desktop.
Save seanquijote/7598d96f2b857e095920b2ec5c32be3f to your computer and use it in GitHub Desktop.
My FizzBuzz Sample
var output;
var maxNum = 100;
const run = () => {
for (var i = 1; i <= maxNum; i++) {
output = "";
if (divide(i, 3) == 0) {
appendOutput("Fizz");
}
if (divide(i, 5) == 0) {
appendOutput("Buzz");
}
if (output == "") {
appendOutput(i);
}
console.log(output);
}
}
const divide = (index, value) => {
return index % value;
}
const appendOutput = (value) => {
output += value;
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment