Skip to content

Instantly share code, notes, and snippets.

@d4gh0s7
Created December 7, 2018 15:05
Show Gist options
  • Save d4gh0s7/8ac0b4c1dc0fced36c075788d62acb42 to your computer and use it in GitHub Desktop.
Save d4gh0s7/8ac0b4c1dc0fced36c075788d62acb42 to your computer and use it in GitHub Desktop.
A simple Fizz-Buzz Test in JavaScript
let config = { };
config.fizzTest = 3;
config.buzzTest = 5;
config.checks = 100;
config.fizzText = 'Fizz';
config.buzzText = 'Buzz';
for (let i = 1; i <= config.checks; i++) {
let expletive = '';
if (i % config.fizzTest === 0) expletive += config.fizzText;
if (i % config.buzzTest === 0) expletive += config.buzzText;
console.log(expletive || i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment